26 lines
653 B
TypeScript
26 lines
653 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { z } from 'zod';
|
|
|
|
const schema = z.object({
|
|
name: z.string().min(2),
|
|
phone: z.string().min(7),
|
|
email: z.string().email(),
|
|
address: z.string().optional(),
|
|
projectType: z.string().min(2),
|
|
urgency: z.string().min(2),
|
|
description: z.string().min(10)
|
|
});
|
|
|
|
describe('contact schema', () => {
|
|
it('accepts valid payload', () => {
|
|
const out = schema.safeParse({
|
|
name: 'Jane',
|
|
phone: '361-555-0000',
|
|
email: 'j@x.com',
|
|
projectType: 'Residential',
|
|
urgency: 'Now',
|
|
description: 'Lights out in kitchen'
|
|
});
|
|
expect(out.success).toBe(true);
|
|
});
|
|
}); |