- Tests caught 2 real bugs:
- Zod NaN bypass in orders/offers schemas (Number(v) || fallback)
- invoiceTotalWithVat using Number() on { toNumber() } objects
- 7 new test files covering auth, env, exchange rates, NAS paths,
schema NaN rejection, invoice VAT calculation, customer validation
- 45 tests passing, build clean
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
20 lines
635 B
TypeScript
20 lines
635 B
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { UpdateCustomerSchema } from "../schemas/customers.schema";
|
|
|
|
describe("UpdateCustomerSchema", () => {
|
|
it("rejects empty name", () => {
|
|
const result = UpdateCustomerSchema.safeParse({ name: "" });
|
|
expect(result.success).toBe(false);
|
|
});
|
|
|
|
it("accepts valid name", () => {
|
|
const result = UpdateCustomerSchema.safeParse({ name: "Acme Corp" });
|
|
expect(result.success).toBe(true);
|
|
});
|
|
|
|
it("accepts partial updates without name", () => {
|
|
const result = UpdateCustomerSchema.safeParse({ street: "Main St" });
|
|
expect(result.success).toBe(true);
|
|
});
|
|
});
|