2023-01-03 13:17:22 +00:00
|
|
|
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
|
|
|
import { createWrapper, axios } from 'app/test/vitest/helper';
|
|
|
|
import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue';
|
|
|
|
|
|
|
|
describe('ClaimDescriptorMenu', () => {
|
|
|
|
let vm;
|
|
|
|
beforeAll(() => {
|
|
|
|
vm = createWrapper(ClaimDescriptorMenu, {
|
|
|
|
propsData: {
|
|
|
|
claim: {
|
|
|
|
id: 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}).vm;
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
vi.clearAllMocks();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('deleteClaim()', () => {
|
|
|
|
it('should delete the claim', async () => {
|
|
|
|
vi.spyOn(axios, 'delete').mockResolvedValue({ data: true });
|
|
|
|
vi.spyOn(vm.quasar, 'notify');
|
|
|
|
|
|
|
|
await vm.deleteClaim();
|
|
|
|
|
2023-02-22 13:55:29 +00:00
|
|
|
expect(vm.quasar.notify).toHaveBeenCalledWith(
|
|
|
|
expect.objectContaining({ type: 'positive' })
|
|
|
|
);
|
2023-01-03 13:17:22 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|