24 lines
710 B
TypeScript
24 lines
710 B
TypeScript
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);
|
|
});
|
|
});
|