feat: refs #7087 added new test

This commit is contained in:
PAU ROVIRA ROSALENY 2025-01-15 08:52:43 +01:00
parent 5bd72c830d
commit 54867597aa
1 changed files with 13 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import { vi, describe, expect, it, beforeAll, afterEach, beforeEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import CardSummary from 'src/components/ui/CardSummary.vue';
import * as vueRouter from 'vue-router';
describe('CardSummary', () => {
let vm;
@ -10,6 +11,14 @@ describe('CardSummary', () => {
vi.spyOn(axios, 'get').mockResolvedValue({ data: [] });
});
vi.spyOn(vueRouter, 'useRoute').mockReturnValue({
query: {},
params: {},
meta: { moduleName: 'mockName' },
path: 'mockName/1/summary',
name: 'CardSummary',
});
beforeEach(() => {
wrapper = createWrapper(CardSummary, {
propsData: {
@ -60,4 +69,8 @@ describe('CardSummary', () => {
expect(vm.store.url).toBe('newUrl');
expect(vm.store.filter).toEqual({ key: 'newValue' });
});
it('should return true if route path ends with /summary' , () => {
expect(vm.isSummary).toBe(true);
});
});