2026-02-10 21:29:48 +02:00
|
|
|
import { createTestingPinia } from '@pinia/testing'
|
2026-02-11 20:42:31 +02:00
|
|
|
|
|
|
|
|
createTestingPinia()
|
|
|
|
|
|
2026-01-06 16:23:17 +02:00
|
|
|
import { createMemoryHistory, createRouter } from 'vue-router'
|
2018-12-06 04:05:35 +03:00
|
|
|
|
2026-01-08 17:26:52 +02:00
|
|
|
import routes from 'src/boot/routes'
|
|
|
|
|
|
2018-12-06 04:05:35 +03:00
|
|
|
describe('routes', () => {
|
2022-03-22 18:56:54 +02:00
|
|
|
const router = createRouter({
|
|
|
|
|
history: createMemoryHistory(),
|
2026-08-19 23:46:51 +03:00
|
|
|
routes: routes(),
|
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-08-19 23:46:51 +03:00
|
|
|
expect(matchedComponents[0].components.default.__file).to.contain(
|
|
|
|
|
'/timeline.vue',
|
|
|
|
|
)
|
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-07-31 17:02:38 +03:00
|
|
|
expect(matchedComponents[0].components.default.__file).to.contain(
|
2026-08-19 23:46:51 +03:00
|
|
|
'/user_profile.vue',
|
2026-06-07 23:44:48 +03:00
|
|
|
)
|
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-07-31 17:02:38 +03:00
|
|
|
expect(matchedComponents[0].components.default.__file).to.contain(
|
2026-08-19 23:46:51 +03:00
|
|
|
'/user_profile.vue',
|
2026-06-07 23:44:48 +03:00
|
|
|
)
|
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-07-31 17:02:38 +03:00
|
|
|
expect(matchedComponents[0].components.default.__file).to.contain(
|
2026-08-19 23:46:51 +03:00
|
|
|
'/lists.vue',
|
2026-06-07 23:44:48 +03:00
|
|
|
)
|
2022-08-06 17:26:43 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('list timeline', async () => {
|
|
|
|
|
await router.push('/lists/1')
|
|
|
|
|
|
|
|
|
|
const matchedComponents = router.currentRoute.value.matched
|
|
|
|
|
|
2026-07-31 17:02:38 +03:00
|
|
|
expect(matchedComponents[0].components.default.__file).to.contain(
|
2026-08-19 23:46:51 +03:00
|
|
|
'/timeline.vue',
|
2026-06-07 23:44:48 +03:00
|
|
|
)
|
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-07-31 17:02:38 +03:00
|
|
|
expect(matchedComponents[0].components.default.__file).to.contain(
|
2026-08-19 23:46:51 +03:00
|
|
|
'/lists_edit.vue',
|
2026-06-07 23:44:48 +03:00
|
|
|
)
|
2022-08-06 17:26:43 +03:00
|
|
|
})
|
2018-12-06 04:05:35 +03:00
|
|
|
})
|