From 3c3956da682e575f2a7e109c2a790a3b38199a89 Mon Sep 17 00:00:00 2001 From: Paul Valerie GOMA Date: Tue, 5 Aug 2025 15:11:51 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20deleted=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/VuseAlert.spec.ts | 34 ---------------------------------- test/VuseConfirmModal.spec.ts | 34 ---------------------------------- 2 files changed, 68 deletions(-) delete mode 100644 test/VuseAlert.spec.ts delete mode 100644 test/VuseConfirmModal.spec.ts 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, - })) - }) -})