2018-12-05 17:05:35 -08:00
|
|
|
import routes from 'src/boot/routes'
|
2022-03-22 09:56:54 -07:00
|
|
|
import { createRouter, createMemoryHistory } from 'vue-router'
|
|
|
|
import { createStore } from 'vuex'
|
2018-12-05 17:05:35 -08:00
|
|
|
|
2022-03-22 09:56:54 -07:00
|
|
|
const store = createStore({
|
2020-05-07 06:10:53 -07:00
|
|
|
state: {
|
|
|
|
instance: {}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2018-12-05 17:05:35 -08:00
|
|
|
describe('routes', () => {
|
2022-03-22 09:56:54 -07:00
|
|
|
const router = createRouter({
|
|
|
|
history: createMemoryHistory(),
|
2020-05-07 06:10:53 -07:00
|
|
|
routes: routes(store)
|
2018-12-05 17:05:35 -08:00
|
|
|
})
|
|
|
|
|
2022-03-22 09:56:54 -07:00
|
|
|
it('root path', async () => {
|
|
|
|
await router.push('/main/all')
|
2018-12-05 17:05:35 -08:00
|
|
|
|
2022-03-22 09:56:54 -07:00
|
|
|
const matchedComponents = router.currentRoute.value.matched
|
2018-12-05 17:05:35 -08:00
|
|
|
|
2022-07-31 02:36:02 -07:00
|
|
|
// eslint-disable-next-line no-prototype-builtins
|
2022-03-22 09:56:54 -07:00
|
|
|
expect(matchedComponents[0].components.default.components.hasOwnProperty('Timeline')).to.eql(true)
|
2018-12-05 17:05:35 -08:00
|
|
|
})
|
|
|
|
|
2022-03-22 09:56:54 -07:00
|
|
|
it('user\'s profile', async () => {
|
|
|
|
await router.push('/fake-user-name')
|
2018-12-05 17:05:35 -08:00
|
|
|
|
2022-03-22 09:56:54 -07:00
|
|
|
const matchedComponents = router.currentRoute.value.matched
|
2018-12-05 17:05:35 -08:00
|
|
|
|
2022-07-31 02:36:02 -07:00
|
|
|
// eslint-disable-next-line no-prototype-builtins
|
2022-03-22 09:56:54 -07:00
|
|
|
expect(matchedComponents[0].components.default.components.hasOwnProperty('UserCard')).to.eql(true)
|
2018-12-05 17:05:35 -08:00
|
|
|
})
|
2018-12-25 09:43:52 -08:00
|
|
|
|
2022-03-22 09:56:54 -07:00
|
|
|
it('user\'s profile at /users', async () => {
|
|
|
|
await router.push('/users/fake-user-name')
|
2018-12-25 09:43:52 -08:00
|
|
|
|
2022-03-22 09:56:54 -07:00
|
|
|
const matchedComponents = router.currentRoute.value.matched
|
2018-12-25 09:43:52 -08:00
|
|
|
|
2022-07-31 02:36:02 -07:00
|
|
|
// eslint-disable-next-line no-prototype-builtins
|
2022-03-22 09:56:54 -07:00
|
|
|
expect(matchedComponents[0].components.default.components.hasOwnProperty('UserCard')).to.eql(true)
|
2018-12-25 09:43:52 -08:00
|
|
|
})
|
2022-08-06 07:26:43 -07:00
|
|
|
|
|
|
|
it('list view', async () => {
|
|
|
|
await router.push('/lists')
|
|
|
|
|
|
|
|
const matchedComponents = router.currentRoute.value.matched
|
|
|
|
|
|
|
|
expect(matchedComponents[0].components.default.components.hasOwnProperty('ListsCard')).to.eql(true)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('list timeline', async () => {
|
|
|
|
await router.push('/lists/1')
|
|
|
|
|
|
|
|
const matchedComponents = router.currentRoute.value.matched
|
|
|
|
|
|
|
|
expect(matchedComponents[0].components.default.components.hasOwnProperty('Timeline')).to.eql(true)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('list edit', async () => {
|
|
|
|
await router.push('/lists/1/edit')
|
|
|
|
|
|
|
|
const matchedComponents = router.currentRoute.value.matched
|
|
|
|
|
|
|
|
expect(matchedComponents[0].components.default.components.hasOwnProperty('BasicUserCard')).to.eql(true)
|
|
|
|
})
|
2018-12-05 17:05:35 -08:00
|
|
|
})
|