46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { kontaktFormSchema, therapeutFormSchema } from "./schema";
|
|
|
|
describe("therapeutFormSchema", () => {
|
|
it("accepts valid therapist", () => {
|
|
const result = therapeutFormSchema.safeParse({
|
|
name: "Dr. Schmidt",
|
|
plz: "10115",
|
|
stadt: "Berlin",
|
|
});
|
|
expect(result.success).toBe(true);
|
|
});
|
|
|
|
it("requires name", () => {
|
|
const result = therapeutFormSchema.safeParse({ name: "" });
|
|
expect(result.success).toBe(false);
|
|
});
|
|
|
|
it("allows empty optional fields", () => {
|
|
const result = therapeutFormSchema.safeParse({ name: "Dr. Schmidt" });
|
|
expect(result.success).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("kontaktFormSchema", () => {
|
|
it("accepts valid contact", () => {
|
|
const result = kontaktFormSchema.safeParse({
|
|
therapeut_id: 1,
|
|
datum: "2026-03-10",
|
|
kanal: "telefon",
|
|
ergebnis: "absage",
|
|
});
|
|
expect(result.success).toBe(true);
|
|
});
|
|
|
|
it("rejects missing date", () => {
|
|
const result = kontaktFormSchema.safeParse({
|
|
therapeut_id: 1,
|
|
datum: "",
|
|
kanal: "telefon",
|
|
ergebnis: "absage",
|
|
});
|
|
expect(result.success).toBe(false);
|
|
});
|
|
});
|