feat: refs #7087 created CardSummary test
This commit is contained in:
parent
c6a9c55ddc
commit
bb6fae5d08
|
@ -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'));
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue