feat(contact): add WCAG 2.2 AA compliant ContactSection and zero-third-party send API
This commit is contained in:
23
tests/contactApi.test.ts
Normal file
23
tests/contactApi.test.ts
Normal 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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user