diff --git a/test/VuseAlert.spec.ts b/test/VuseAlert.spec.ts deleted file mode 100644 index 7ab4c4e..0000000 --- a/test/VuseAlert.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { describe, it, expect, vi } from 'vitest' - -// 1️⃣ Mock BEFORE importing useAlert -const addSpy = vi.fn() -vi.mock('primevue/usetoast', () => ({ - useToast: () => ({ - add: addSpy - }) -})) - -// 2️⃣ Import le module après que le mock soit actif -import { useAlert } from '../src/components/composable/useAlert' - -describe('useAlert', () => { - it('should call toast.add with correct options', () => { - const { showAlert } = useAlert() - - showAlert({ - title: 'Test title', - description: 'Test description', - type: 'warn', - closeable: true, - lifeTime: 3000, - }) - - expect(addSpy).toHaveBeenCalledWith({ - severity: 'warn', - summary: 'Test title', - detail: 'Test description', - closable: true, - life: 3000, - }) - }) -}) diff --git a/test/VuseConfirmModal.spec.ts b/test/VuseConfirmModal.spec.ts deleted file mode 100644 index 7cb0661..0000000 --- a/test/VuseConfirmModal.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -// tests/useConfirmModal.spec.ts -import { describe, it, expect, vi } from 'vitest' - -// ✅ Mock AVANT import de useConfirmModal -const requireSpy = vi.fn() -vi.mock('primevue', () => ({ - useConfirm: () => ({ - require: requireSpy - }) -})) - -import { useConfirmModal } from '../src/components/composable/useConfirmModal' - -describe('useConfirmModal', () => { - it('should call confirm.require with the given options', () => { - const { showConfirmModal } = useConfirmModal() - - const options = { - header: 'Confirm Header', - message: 'Are you sure?', - accept: vi.fn(), - reject: vi.fn(), - } - - showConfirmModal(options) - - expect(requireSpy).toHaveBeenCalledWith(expect.objectContaining({ - header: 'Confirm Header', - message: 'Are you sure?', - accept: options.accept, - reject: options.reject, - })) - }) -})