🔥 deleted files

This commit is contained in:
Paul Valerie GOMA 2025-08-05 15:11:51 +02:00
parent 65a2f9028a
commit 3c3956da68
2 changed files with 0 additions and 68 deletions

View File

@ -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,
})
})
})

View File

@ -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,
}))
})
})