import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import { createRouter, createMemoryHistory } from 'vue-router'
import AppFooter from '@/components/AppFooter.vue'
function createTestRouter() {
return createRouter({
history: createMemoryHistory(),
routes: [
{
path: '/om-oss',
name: 'about',
component: { template: '
About
' },
},
{
path: '/om',
redirect: '/om-oss',
},
{
path: '/kontakt',
name: 'contact',
component: { template: 'Contact
' },
},
{
path: '/integritetspolicy',
name: 'privacy',
component: { template: 'Privacy
' },
},
{
path: '/villkor',
name: 'terms',
component: { template: 'Terms
' },
},
],
})
}
describe('AppFooter', () => {
it('renders all four links', () => {
const router = createTestRouter()
const wrapper = mount(AppFooter, {
global: { plugins: [router] },
})
const links = wrapper.findAll('a')
expect(links[0].text()).toBe('Om oss')
expect(links[0].attributes('href')).toBe('/om-oss')
expect(links[1].text()).toBe('Kontakt')
expect(links[1].attributes('href')).toBe('/kontakt')
expect(links[2].text()).toBe('Integritetspolicy')
expect(links[2].attributes('href')).toBe('/integritetspolicy')
expect(links[3].text()).toBe('Villkor')
expect(links[3].attributes('href')).toBe('/villkor')
})
})