import { shallowMount } from '@vue/test-utils'; import { createRouter, createWebHistory, } from 'vue-router'; import signetRouter from '@/router'; import FundLink from '@/components/FundLink.vue'; import { expect } from 'chai'; const router = createRouter({ history: createWebHistory(), routes: signetRouter.getRoutes(), }); describe('router', () => { it('requires permissions before routing', async () => { await router.push('/admin/modifyuser'); const admin = router.options.routes.find((r) => r.path === '/admin'); const permissionsOnAllAdmin = admin && admin.children && admin.children.length > 0 && admin.children.every((r) => r.meta && r.meta.requiredRights); expect(permissionsOnAllAdmin); }); }); describe('FundLink.vue', () => { it('renders props.msg when passed', () => { const msg = 'new message'; const wrapper = shallowMount(FundLink, { props: { msg }, }); expect(wrapper.text()) .to .include(msg); }); });