routes.spec.js 955 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import routes from 'src/boot/routes'
  2. import { createLocalVue } from '@vue/test-utils'
  3. import VueRouter from 'vue-router'
  4. const localVue = createLocalVue()
  5. localVue.use(VueRouter)
  6. describe('routes', () => {
  7. const router = new VueRouter({
  8. mode: 'abstract',
  9. routes: routes({})
  10. })
  11. it('root path', () => {
  12. router.push('/main/all')
  13. const matchedComponents = router.getMatchedComponents()
  14. expect(matchedComponents[0].components.hasOwnProperty('Timeline')).to.eql(true)
  15. })
  16. it('user\'s profile', () => {
  17. router.push('/fake-user-name')
  18. const matchedComponents = router.getMatchedComponents()
  19. expect(matchedComponents[0].components.hasOwnProperty('UserCard')).to.eql(true)
  20. })
  21. it('user\'s profile at /users', () => {
  22. router.push('/users/fake-user-name')
  23. const matchedComponents = router.getMatchedComponents()
  24. expect(matchedComponents[0].components.hasOwnProperty('UserCard')).to.eql(true)
  25. })
  26. })