akkoma-fe/test/unit/specs/boot/routes.spec.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

import routes from 'src/boot/routes'
2022-03-22 16:56:54 +00:00
import { createRouter, createMemoryHistory } from 'vue-router'
import { createStore } from 'vuex'
2022-03-22 16:56:54 +00:00
const store = createStore({
2020-05-07 13:10:53 +00:00
state: {
instance: {}
}
})
describe('routes', () => {
2022-03-22 16:56:54 +00:00
const router = createRouter({
history: createMemoryHistory(),
2020-05-07 13:10:53 +00:00
routes: routes(store)
})
2022-03-22 16:56:54 +00:00
it('root path', async () => {
await router.push('/main/all')
2022-03-22 16:56:54 +00:00
const matchedComponents = router.currentRoute.value.matched
2022-03-22 16:56:54 +00:00
expect(matchedComponents[0].components.default.components.hasOwnProperty('Timeline')).to.eql(true)
})
2022-03-22 16:56:54 +00:00
it('user\'s profile', async () => {
await router.push('/fake-user-name')
2022-03-22 16:56:54 +00:00
const matchedComponents = router.currentRoute.value.matched
2022-03-22 16:56:54 +00:00
expect(matchedComponents[0].components.default.components.hasOwnProperty('UserCard')).to.eql(true)
})
2022-03-22 16:56:54 +00:00
it('user\'s profile at /users', async () => {
await router.push('/users/fake-user-name')
2022-03-22 16:56:54 +00:00
const matchedComponents = router.currentRoute.value.matched
2022-03-22 16:56:54 +00:00
expect(matchedComponents[0].components.default.components.hasOwnProperty('UserCard')).to.eql(true)
})
})