#8448 - devToTest #1254

Merged
alexm merged 365 commits from 8448-devToTest into test 2025-01-21 10:44:46 +00:00
1 changed files with 48 additions and 0 deletions
Showing only changes of commit bb6fae5d08 - Show all commits

View File

@ -0,0 +1,48 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import CardSummary from 'src/components/ui/CardSummary.vue';
describe('CardSummary', () => {
let vm;
let wrapper;
beforeAll(() => {
const mockApiResponse = {
data: {
data: [],
total: 0,
}
};
vi.spyOn(axios, 'get').mockResolvedValue(mockApiResponse);
wrapper = createWrapper(CardSummary, {
global: {
stubs: [
'arrayData',
'useArrayData',
],
mocks: {
validate: vi.fn(),
},
},
propsData: {
dataKey: 'cardSummaryKey',
url: 'cardSummaryUrl',
},
});
vm = wrapper.vm;
wrapper = wrapper.wrapper;
});
afterEach(() => {
vi.clearAllMocks();
});
it('should fetch data', async () => {
expect(wrapper.emitted('fetch'));
});
});