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