diff --git a/frontend/src/__tests__/AboutPage.spec.ts b/frontend/src/__tests__/AboutPage.spec.ts index ac4ebd8..8563c1f 100644 --- a/frontend/src/__tests__/AboutPage.spec.ts +++ b/frontend/src/__tests__/AboutPage.spec.ts @@ -1,10 +1,44 @@ import { describe, it, expect } from 'vitest' import { mount } from '@vue/test-utils' +import { createRouter, createMemoryHistory } from 'vue-router' import AboutPage from '@/pages/AboutPage.vue' +function createTestRouter() { + return createRouter({ + history: createMemoryHistory(), + routes: [ + { path: '/om-oss', name: 'about', component: AboutPage }, + { path: '/', name: 'home', component: { template: '
Home
' } }, + ], + }) +} + describe('AboutPage', () => { - it('renders heading', () => { - const wrapper = mount(AboutPage) + it('renders heading and lead', () => { + const router = createTestRouter() + const wrapper = mount(AboutPage, { + global: { plugins: [router] }, + }) expect(wrapper.text()).toContain('Om Bilhej') + expect(wrapper.text()).toContain('Bilhej gör det enkelt') + }) + + it('renders how-it-works steps', () => { + const router = createTestRouter() + const wrapper = mount(AboutPage, { + global: { plugins: [router] }, + }) + expect(wrapper.text()).toContain('Skriv brevet här') + expect(wrapper.text()).toContain('Vi postar åt dig') + }) + + it('links to home page', () => { + const router = createTestRouter() + const wrapper = mount(AboutPage, { + global: { plugins: [router] }, + }) + const cta = wrapper.find('a.about__cta-btn') + expect(cta.exists()).toBe(true) + expect(cta.attributes('href')).toBe('/') }) }) diff --git a/frontend/src/__tests__/AppFooter.spec.ts b/frontend/src/__tests__/AppFooter.spec.ts index 42587d1..80f9b85 100644 --- a/frontend/src/__tests__/AppFooter.spec.ts +++ b/frontend/src/__tests__/AppFooter.spec.ts @@ -8,10 +8,14 @@ function createTestRouter() { history: createMemoryHistory(), routes: [ { - path: '/om', + path: '/om-oss', name: 'about', component: { template: '
About
' }, }, + { + path: '/om', + redirect: '/om-oss', + }, { path: '/kontakt', name: 'contact', @@ -40,7 +44,7 @@ describe('AppFooter', () => { const links = wrapper.findAll('a') expect(links[0].text()).toBe('Om oss') - expect(links[0].attributes('href')).toBe('/om') + expect(links[0].attributes('href')).toBe('/om-oss') expect(links[1].text()).toBe('Kontakt') expect(links[1].attributes('href')).toBe('/kontakt') diff --git a/frontend/src/components/AppFooter.vue b/frontend/src/components/AppFooter.vue index 0d11d4c..b83473f 100644 --- a/frontend/src/components/AppFooter.vue +++ b/frontend/src/components/AppFooter.vue @@ -6,11 +6,10 @@ import { RouterLink } from 'vue-router'