add contact tracker data layer: schemas, hooks, db queries
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user