The frontend for the project formerly known as signet, now known as beignet.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

example.spec.ts 995 B

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1234567891011121314151617181920212223242526272829303132333435
  1. import { shallowMount } from '@vue/test-utils';
  2. import {
  3. createRouter,
  4. createWebHistory,
  5. } from 'vue-router';
  6. import signetRouter from '@/router';
  7. import FundLink from '@/components/FundLink.vue';
  8. import { expect } from 'chai';
  9. const router = createRouter({
  10. history: createWebHistory(),
  11. routes: signetRouter.getRoutes(),
  12. });
  13. describe('router', () => {
  14. it('requires permissions before routing', async () => {
  15. await router.push('/admin/modifyuser');
  16. const admin = router.options.routes.find((r) => r.path === '/admin');
  17. const permissionsOnAllAdmin = admin && admin.children && admin.children.length > 0
  18. && admin.children.every((r) => r.meta && r.meta.requiredRights);
  19. expect(permissionsOnAllAdmin);
  20. });
  21. });
  22. describe('FundLink.vue', () => {
  23. it('renders props.msg when passed', () => {
  24. const msg = 'new message';
  25. const wrapper = shallowMount(FundLink, {
  26. props: { msg },
  27. });
  28. expect(wrapper.text())
  29. .to
  30. .include(msg);
  31. });
  32. });