MCPcopy
hub / github.com/colinhacks/zod / base

Function base

packages/zod/src/v4/classic/tests/async-parsing.test.ts:330–343  ·  view source on GitHub ↗
(is_async?: boolean)

Source from the content-addressed store, hash-verified

328
329test("async validation multiple errors 2", async () => {
330 const base = (is_async?: boolean) =>
331 z.object({
332 hello: z.string(),
333 foo: z.object({
334 bar: z.number().refine(
335 is_async
336 ? async () =>
337 new Promise((resolve) => {
338 setTimeout(() => resolve(false), 500);
339 })
340 : () => false
341 ),
342 }),
343 });
344
345 const testval = { hello: 3, foo: { bar: 4 } };
346 const result1 = base().safeParse(testval);

Callers 1

Calls 3

stringMethod · 0.80
refineMethod · 0.80
numberMethod · 0.80

Tested by

no test coverage detected