import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import { createPinia, setActivePinia } from 'pinia'
import { createRouter, createMemoryHistory } from 'vue-router'
import App from '@/App.vue'
function makeRouter() {
return createRouter({
history: createMemoryHistory(),
routes: [
{ path: '/', redirect: '/cv' },
{ path: '/cv', name: 'cv', component: { template: '
CV
' } },
{ path: '/research', name: 'research', component: { template: 'Research
' } },
{ path: '/applications', name: 'applications', component: { template: 'Applications
' } },
{ path: '/applications/:id', name: 'application-detail', component: { template: 'Detail
' } }
]
})
}
describe('Router tabs', () => {
it('renders all three tab links', async () => {
setActivePinia(createPinia())
const router = makeRouter()
await router.push('/cv')
await router.isReady()
const wrapper = mount(App, { global: { plugins: [router] } })
const links = wrapper.findAll('nav a')
expect(links).toHaveLength(3)
expect(links[0].text()).toBe('CV')
expect(links[1].text()).toBe('Research')
expect(links[2].text()).toBe('Applications')
})
})