diff --git a/backend/src/config/links.js b/backend/src/config/links.js index c6f932c82..6b945a5e0 100644 --- a/backend/src/config/links.js +++ b/backend/src/config/links.js @@ -1,7 +1,13 @@ // this file is duplicated in `backend/src/config/links.js` and `webapp/constants/links.js` and replaced on rebranding export default { ORGANIZATION: 'https://ocelot.social', - DONATE: 'https://ocelot-social.herokuapp.com/donations', - FAQ: 'https://ocelot.social', SUPPORT: 'https://ocelot.social', + + // on null or empty strings internal imprint is used, see 'webapp/locales/html/' + DONATE: 'https://ocelot-social.herokuapp.com/donations', // we use 'ocelot-social.herokuapp.com' at the moment, because redirections of 'ocelot.social' subpages are not working correctly + IMPRINT: 'https://ocelot-social.herokuapp.com/imprint', // we use 'ocelot-social.herokuapp.com' at the moment, because redirections of 'ocelot.social' subpages are not working correctly + TERMS_AND_CONDITIONS: null, + CODE_OF_CONDUCT: null, + DATA_PRIVACY: null, + FAQ: 'https://ocelot.social', } diff --git a/webapp/components/PageFooter/PageFooter.spec.js b/webapp/components/PageFooter/PageFooter.spec.js index 0edc0fed2..53aaaa073 100644 --- a/webapp/components/PageFooter/PageFooter.spec.js +++ b/webapp/components/PageFooter/PageFooter.spec.js @@ -1,6 +1,6 @@ import { config, mount } from '@vue/test-utils' import PageFooter from './PageFooter.vue' -import links from '~/constants/links.js' +import linksDefault from '~/constants/links.js' const localVue = global.localVue @@ -8,6 +8,7 @@ config.stubs['nuxt-link'] = '' describe('PageFooter.vue', () => { let mocks + let wrapper beforeEach(() => { mocks = { @@ -15,30 +16,118 @@ describe('PageFooter.vue', () => { $env: { VERSION: 'v1.0.0', }, - links, } }) describe('mount', () => { - let wrapper const Wrapper = () => { return mount(PageFooter, { mocks, localVue }) } - beforeEach(() => { - wrapper = Wrapper() + describe('links.js', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders four links', () => { + expect(wrapper.findAll('a')).toHaveLength(4) + }) + + it('renders three nuxt-links', () => { + expect(wrapper.findAll('.nuxt-link')).toHaveLength(3) + }) + + it('renders version', () => { + expect(wrapper.find('.ds-footer').text()).toContain('v1.0.0') + }) }) - it('renders three links', () => { - expect(wrapper.findAll('a')).toHaveLength(3) + describe('inflexible links', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders ORGANIZATION', () => { + expect(wrapper.find('a[data-test="organization-link"]').exists()).toBe(true) + }) + + it('renders version', () => { + expect(wrapper.find('a[data-test="version-link"]').exists()).toBe(true) + }) }) - it('renders four nuxt-links', () => { - expect(wrapper.findAll('.nuxt-link')).toHaveLength(4) + describe('flexible links not set', () => { + beforeEach(async () => { + const links = { + ...linksDefault, + IMPRINT: null, + TERMS_AND_CONDITIONS: null, + CODE_OF_CONDUCT: null, + DATA_PRIVACY: null, + FAQ: null, + } + wrapper = Wrapper() + wrapper.setData({ links }) + await wrapper.vm.$nextTick() + }) + + it('renders IMPRINT as nuxt-link', () => { + expect(wrapper.find('span[data-test="imprint-nuxt-link"]').exists()).toBe(true) + }) + + it('renders TERMS_AND_CONDITIONS as nuxt-link', () => { + expect(wrapper.find('span[data-test="terms-nuxt-link"]').exists()).toBe(true) + }) + + it('renders CODE_OF_CONDUCT as nuxt-link', () => { + expect(wrapper.find('span[data-test="code-nuxt-link"]').exists()).toBe(true) + }) + + it('renders DATA_PRIVACY as nuxt-link', () => { + expect(wrapper.find('span[data-test="data-nuxt-link"]').exists()).toBe(true) + }) + + it('renders FAQ as nuxt-link', () => { + expect(wrapper.find('span[data-test="faq-nuxt-link"]').exists()).toBe(true) + }) }) - it('renders version', () => { - expect(wrapper.find('.ds-footer').text()).toContain('v1.0.0') + describe('flexible links set', () => { + beforeEach(async () => { + const links = { + ...linksDefault, + IMPRINT: 'https://ocelot.social/IMPRINT', + TERMS_AND_CONDITIONS: 'https://ocelot.social/TERMS_AND_CONDITIONS', + CODE_OF_CONDUCT: 'https://ocelot.social/CODE_OF_CONDUCT', + DATA_PRIVACY: 'https://ocelot.social/DATA_PRIVACY', + FAQ: 'https://ocelot.social/FAQ', + } + wrapper = Wrapper() + wrapper.setData({ links }) + await wrapper.vm.$nextTick() + }) + + it('renders IMPRINT as "a" tag link', () => { + expect(wrapper.find(`a[href="https://ocelot.social/IMPRINT"]`).exists()).toBe(true) + }) + + it('renders TERMS_AND_CONDITIONS as "a" tag link', () => { + expect(wrapper.find(`a[href="https://ocelot.social/TERMS_AND_CONDITIONS"]`).exists()).toBe( + true, + ) + }) + + it('renders CODE_OF_CONDUCT as "a" tag link', () => { + expect(wrapper.find(`a[href="https://ocelot.social/CODE_OF_CONDUCT"]`).exists()).toBe(true) + }) + + it('renders DATA_PRIVACY as "a" tag link', () => { + expect(wrapper.find(`a[href="https://ocelot.social/DATA_PRIVACY"]`).exists()).toBe(true) + }) + + it('renders FAQ as "a" tag link', () => { + expect(wrapper.find(`a[href="https://ocelot.social/FAQ"]`).exists()).toBe(true) + }) }) }) }) diff --git a/webapp/components/PageFooter/PageFooter.vue b/webapp/components/PageFooter/PageFooter.vue index ace0514e1..e31bc3e2a 100644 --- a/webapp/components/PageFooter/PageFooter.vue +++ b/webapp/components/PageFooter/PageFooter.vue @@ -1,26 +1,67 @@