import { describe, expect, it } from "@suaveplan/testing/runner"; import fc from "fast-check"; import { CreateVaultItemBodySchema } from "../src/schemas/vault-item.js"; describe("CreateVaultItemBodySchema fast-check size invariant", () => { it("size invariant: payloads under 10 MiB always validate (200 runs)", { timeout: 60_000, }, () => { fc.assert( fc.property( fc.record({ title: fc.string({ minLength: 1, maxLength: 64 }), kind: fc.string({ minLength: 1, maxLength: 32 }), body: fc.string({ maxLength: 4096 }), }), (sample) => { const result = CreateVaultItemBodySchema.safeParse(sample); // Payloads of arbitrary string body, title and kind // pass the schema — schema does not enforce body // size; that is enforced at the route layer. expect(result.success).toBe(true); } ), { numRuns: 200 } ); }); });