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('remove()', () => {
        it('should delete the claim', async () => {
            vi.spyOn(axios, 'delete').mockResolvedValue({ data: true });
            vi.spyOn(vm.quasar, 'notify');

            await vm.remove();

            expect(vm.quasar.notify).toHaveBeenCalledWith(
                expect.objectContaining({ type: 'positive' })
            );
        });
    });
});