49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
import { jest, describe, expect, it, beforeAll } from '@jest/globals';
|
|
import { createWrapper, axios } from 'app/tests/jest/jestHelpers';
|
|
import ClaimDescriptorMenu from '../Card/ClaimDescriptorMenu.vue';
|
|
|
|
const mockPush = jest.fn();
|
|
|
|
jest.mock('vue-router', () => ({
|
|
useRouter: () => ({
|
|
push: mockPush,
|
|
currentRoute: {
|
|
value: {
|
|
params: {
|
|
id: 1,
|
|
},
|
|
},
|
|
},
|
|
}),
|
|
}));
|
|
|
|
describe('ClaimDescriptorMenu', () => {
|
|
let vm;
|
|
beforeAll(() => {
|
|
vm = createWrapper(ClaimDescriptorMenu, {
|
|
propsData: {
|
|
claim: {
|
|
id: 1
|
|
}
|
|
}
|
|
}).vm;
|
|
});
|
|
|
|
afterEach(() => {
|
|
jest.clearAllMocks();
|
|
});
|
|
|
|
describe('deleteClaim()', () => {
|
|
it('should delete the claim', async () => {
|
|
jest.spyOn(axios, 'delete').mockResolvedValue({ data: true });
|
|
jest.spyOn(vm.quasar, 'notify');
|
|
|
|
await vm.deleteClaim();
|
|
|
|
expect(vm.quasar.notify).toHaveBeenCalledWith(expect.objectContaining(
|
|
{ 'type': 'positive' }
|
|
));
|
|
});
|
|
});
|
|
});
|