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