feat(contact): add WCAG 2.2 AA compliant ContactSection and zero-third-party send API

This commit is contained in:
Daniel S
2026-08-09 21:18:09 +02:00
parent 0c073983e9
commit 58fc8e51cd
3 changed files with 221 additions and 0 deletions

23
tests/contactApi.test.ts Normal file
View File

@@ -0,0 +1,23 @@
import { describe, it, expect } from 'vitest';
describe('Contact API Spamschutz & Validierung', () => {
it('soll Honeypot-Anfragen lautlos abfangen', async () => {
const hpPayload = {
sender_name: 'Bot',
sender_email: 'bot@spam.com',
message_text: 'Spam text',
privacy_consent: true,
website_hp: 'http://spam-link.com'
};
// Simulated check
const isBot = Boolean(hpPayload.website_hp);
expect(isBot).toBe(true);
});
it('soll ungültige E-Mail-Adressen ablehnen', () => {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
expect(emailRegex.test('invalid-email')).toBe(false);
expect(emailRegex.test('max@beispiel.de')).toBe(true);
});
});