/opt/canhelp/node_modules/zod/src/v4/classic/tests
NameSizeModeActions
anyunknown.test.ts6390644editdlrm
array.test.ts72840644editdlrm
assignability.test.ts67900644editdlrm
async-parsing.test.ts123110644editdlrm
async-refinements.test.ts18670644editdlrm
base.test.ts1790644editdlrm
bigint.test.ts19560644editdlrm
brand.test.ts22060644editdlrm
catch.test.ts72240644editdlrm
coalesce.test.ts7430644editdlrm
coerce.test.ts77360644editdlrm
continuability.test.ts74780644editdlrm
custom.test.ts12150644editdlrm
date.test.ts9620644editdlrm
datetime.test.ts115110644editdlrm
default.test.ts77170644editdlrm
description.test.ts12940644editdlrm
discriminated-unions.test.ts168100644editdlrm
enum.test.ts84880644editdlrm
error-utils.test.ts125720644editdlrm
error.test.ts195020644editdlrm
file.test.ts24600644editdlrm
firstparty.test.ts29770644editdlrm
function.test.ts62990644editdlrm
generics.test.ts21620644editdlrm
index.test.ts275620644editdlrm
instanceof.test.ts10520644editdlrm
intersection.test.ts47630644editdlrm
json.test.ts33090644editdlrm
lazy.test.ts47560644editdlrm
literal.test.ts24780644editdlrm
map.test.ts48170644editdlrm
nan.test.ts6450644editdlrm
nested-refine.test.ts36230644editdlrm
nonoptional.test.ts24050644editdlrm
nullable.test.ts5910644editdlrm
number.test.ts78270644editdlrm
object.test.ts159990644editdlrm
optional.test.ts41300644editdlrm
partial.test.ts48350644editdlrm
pickomit.test.ts44220644editdlrm
pipe.test.ts18480644editdlrm
prefault.test.ts10070644editdlrm
preprocess.test.ts69590644editdlrm
primitive.test.ts76490644editdlrm
promise.test.ts23150644editdlrm
prototypes.test.ts4980644editdlrm
readonly.test.ts117770644editdlrm
record.test.ts81180644editdlrm
recursive-types.test.ts73350644editdlrm
refine.test.ts147740644editdlrm
registries.test.ts59990644editdlrm
set.test.ts55720644editdlrm
standard-schema.test.ts13690644editdlrm
string-formats.test.ts30680644editdlrm
string.test.ts641240644editdlrm
stringbool.test.ts23330644editdlrm
template-literal.test.ts348360644editdlrm
to-json-schema.test.ts592760644editdlrm
transform.test.ts60000644editdlrm
tuple.test.ts47020644editdlrm
union.test.ts24970644editdlrm
validations.test.ts67360644editdlrm
void.test.ts3060644editdlrm
Edit: /opt/canhelp/node_modules/zod/src/v4/classic/tests/validations.test.ts (6736B)
import { expect, test } from "vitest"; import * as z from "zod/v4"; test("string length", async () => { try { await z.string().length(4).parseAsync("asd"); } catch (err) { // ("String must contain exactly 4 character(s)"); expect((err as z.ZodError).issues).toMatchInlineSnapshot(` [ { "code": "too_small", "exact": true, "inclusive": true, "message": "Too small: expected string to have >=4 characters", "minimum": 4, "origin": "string", "path": [], }, ] `); } try { await z.string().length(4).parseAsync("asdaa"); } catch (err) { // ("String must contain exactly 4 character(s)"); expect((err as z.ZodError).issues).toMatchInlineSnapshot(` [ { "code": "too_big", "exact": true, "inclusive": true, "maximum": 4, "message": "Too big: expected string to have <=4 characters", "origin": "string", "path": [], }, ] `); } }); test("string min/max", async () => { try { await z.string().min(4).parseAsync("asd"); } catch (err) { // ("String must contain at least 4 character(s)"); expect((err as z.ZodError).issues).toMatchInlineSnapshot(` [ { "code": "too_small", "inclusive": true, "message": "Too small: expected string to have >=4 characters", "minimum": 4, "origin": "string", "path": [], }, ] `); } }); test("string max", async () => { try { await z.string().max(4).parseAsync("aasdfsdfsd"); } catch (err) { // ("String must contain at most 4 character(s)"); expect((err as z.ZodError).issues).toMatchInlineSnapshot(` [ { "code": "too_big", "inclusive": true, "maximum": 4, "message": "Too big: expected string to have <=4 characters", "origin": "string", "path": [], }, ] `); } }); test("number min", async () => { try { await z.number().min(3).parseAsync(2); } catch (err) { // ("Number must be greater than or equal to 3"); expect((err as z.ZodError).issues).toMatchInlineSnapshot(` [ { "code": "too_small", "inclusive": true, "message": "Too small: expected number to be >=3", "minimum": 3, "origin": "number", "path": [], }, ] `); } }); test("number gte", async () => { try { await z.number().gte(3).parseAsync(2); } catch (err) { // ("Number must be greater than or equal to 3"); expect((err as z.ZodError).issues).toMatchInlineSnapshot(` [ { "code": "too_small", "inclusive": true, "message": "Too small: expected number to be >=3", "minimum": 3, "origin": "number", "path": [], }, ] `); } }); test("number gt", async () => { try { await z.number().gt(3).parseAsync(3); } catch (err) { // ("Number must be greater than or equal to 3"); expect((err as z.ZodError).issues).toMatchInlineSnapshot(` [ { "code": "too_small", "inclusive": false, "message": "Too small: expected number to be >3", "minimum": 3, "origin": "number", "path": [], }, ] `); } }); test("number max", async () => { try { await z.number().max(3).parseAsync(4); } catch (err) { // ("Number must be less than or equal to 3"); expect((err as z.ZodError).issues).toMatchInlineSnapshot(` [ { "code": "too_big", "inclusive": true, "maximum": 3, "message": "Too big: expected number to be <=3", "origin": "number", "path": [], }, ] `); } }); test("number lte", async () => { try { await z.number().lte(3).parseAsync(4); } catch (err) { // ("Number must be less than or equal to 3"); expect((err as z.ZodError).issues).toMatchInlineSnapshot(` [ { "code": "too_big", "inclusive": true, "maximum": 3, "message": "Too big: expected number to be <=3", "origin": "number", "path": [], }, ] `); } }); test("number lt", async () => { try { await z.number().lt(3).parseAsync(3); } catch (err) { // ("Number must be less than or equal to 3"); expect((err as z.ZodError).issues).toMatchInlineSnapshot(` [ { "code": "too_big", "inclusive": false, "maximum": 3, "message": "Too big: expected number to be <3", "origin": "number", "path": [], }, ] `); } }); test("number nonnegative", async () => { try { await z.number().nonnegative().parseAsync(-1); } catch (err) { // ("Number must be greater than or equal to 0"); expect((err as z.ZodError).issues).toMatchInlineSnapshot(` [ { "code": "too_small", "inclusive": true, "message": "Too small: expected number to be >=0", "minimum": 0, "origin": "number", "path": [], }, ] `); } }); test("number nonpositive", async () => { try { await z.number().nonpositive().parseAsync(1); } catch (err) { // ("Number must be less than or equal to 0"); expect((err as z.ZodError).issues).toMatchInlineSnapshot(` [ { "code": "too_big", "inclusive": true, "maximum": 0, "message": "Too big: expected number to be <=0", "origin": "number", "path": [], }, ] `); } }); test("number negative", async () => { try { await z.number().negative().parseAsync(1); } catch (err) { // ("Number must be less than 0"); expect((err as z.ZodError).issues).toMatchInlineSnapshot(` [ { "code": "too_big", "inclusive": false, "maximum": 0, "message": "Too big: expected number to be <0", "origin": "number", "path": [], }, ] `); } }); test("number positive", async () => { try { await z.number().positive().parseAsync(-1); } catch (err) { // ("Number must be greater than 0"); expect((err as z.ZodError).issues).toMatchInlineSnapshot(` [ { "code": "too_small", "inclusive": false, "message": "Too small: expected number to be >0", "minimum": 0, "origin": "number", "path": [], }, ] `); } });