logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

routes.spec.js (2062B)


  1. import routes from 'src/boot/routes'
  2. import { createRouter, createMemoryHistory } from 'vue-router'
  3. import { createStore } from 'vuex'
  4. const store = createStore({
  5. state: {
  6. instance: {}
  7. }
  8. })
  9. describe('routes', () => {
  10. const router = createRouter({
  11. history: createMemoryHistory(),
  12. routes: routes(store)
  13. })
  14. it('root path', async () => {
  15. await router.push('/main/all')
  16. const matchedComponents = router.currentRoute.value.matched
  17. // eslint-disable-next-line no-prototype-builtins
  18. expect(matchedComponents[0].components.default.components.hasOwnProperty('Timeline')).to.eql(true)
  19. })
  20. it('user\'s profile', async () => {
  21. await router.push('/fake-user-name')
  22. const matchedComponents = router.currentRoute.value.matched
  23. // eslint-disable-next-line no-prototype-builtins
  24. expect(matchedComponents[0].components.default.components.hasOwnProperty('UserCard')).to.eql(true)
  25. })
  26. it('user\'s profile at /users', async () => {
  27. await router.push('/users/fake-user-name')
  28. const matchedComponents = router.currentRoute.value.matched
  29. // eslint-disable-next-line no-prototype-builtins
  30. expect(matchedComponents[0].components.default.components.hasOwnProperty('UserCard')).to.eql(true)
  31. })
  32. it('list view', async () => {
  33. await router.push('/lists')
  34. const matchedComponents = router.currentRoute.value.matched
  35. expect(Object.prototype.hasOwnProperty.call(matchedComponents[0].components.default.components, 'ListsCard')).to.eql(true)
  36. })
  37. it('list timeline', async () => {
  38. await router.push('/lists/1')
  39. const matchedComponents = router.currentRoute.value.matched
  40. expect(Object.prototype.hasOwnProperty.call(matchedComponents[0].components.default.components, 'Timeline')).to.eql(true)
  41. })
  42. it('list edit', async () => {
  43. await router.push('/lists/1/edit')
  44. const matchedComponents = router.currentRoute.value.matched
  45. expect(Object.prototype.hasOwnProperty.call(matchedComponents[0].components.default.components, 'BasicUserCard')).to.eql(true)
  46. })
  47. })