feat(testing): add vitest suite + guerrilla mail email pool

- Vitest unit tests for POST /api/erase: validation, form-only
  providers, all email providers, CRLF sanitization
- Snapshot on PROVIDER_DATA to catch provider config drift
- Mock via require cache to avoid nodemailer/sendmail dependency
- sendErasureMail call assertions (args + call count)
- fetch-test-emails.mjs script to refresh disposable email pool
- mailer: add Reply-To header pointing to requester email
- mailer: fallback to direct transport when sendmail unavailable
This commit is contained in:
robacheque 2026-04-17 22:47:06 +02:00
parent 93d75ddafe
commit 15faa5b136
7 changed files with 343 additions and 10 deletions

14
api/vitest.config.js Normal file
View file

@ -0,0 +1,14 @@
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
environment: 'node',
server: {
deps: {
// Force Vite to transform local source files (not just node_modules)
// so vi.mock() can intercept require() calls inside CJS route handlers
inline: [/routes\//, /services\//],
},
},
},
});