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();
|
|
|
|
});
|
|
|
|
|
2023-03-10 12:15:26 +00:00
|
|
|
describe('remove()', () => {
|
2023-01-03 13:17:22 +00:00
|
|
|
it('should delete the claim', async () => {
|
|
|
|
vi.spyOn(axios, 'delete').mockResolvedValue({ data: true });
|
|
|
|
vi.spyOn(vm.quasar, 'notify');
|
|
|
|
|
2023-03-10 12:15:26 +00:00
|
|
|
await vm.remove();
|
2023-01-03 13:17:22 +00:00
|
|
|
|
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
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|