Buckets:
ktongue/docker_container / .opencode /node_modules /zod /src /v4 /classic /tests /standard-schema.test.ts
| import { expect, test } from "vitest"; | |
| import * as z from "zod/v4"; | |
| test("length checks", async () => { | |
| const schema = z.string(); | |
| const result = await schema["~standard"].validate(12); | |
| expect(result).toMatchInlineSnapshot(` | |
| { | |
| "issues": [ | |
| { | |
| "code": "invalid_type", | |
| "expected": "string", | |
| "message": "Invalid input: expected string, received number", | |
| "path": [], | |
| }, | |
| ], | |
| } | |
| `); | |
| }); | |
| test("length checks", async () => { | |
| const schema = z.string(); | |
| const result = await schema["~standard"].validate("asdf"); | |
| expect(result).toMatchInlineSnapshot(` | |
| { | |
| "value": "asdf", | |
| } | |
| `); | |
| }); | |
| test("length checks", async () => { | |
| const schema = z.string().refine(async (val) => val.length > 5); | |
| const result = await schema["~standard"].validate(12); | |
| expect(result).toMatchInlineSnapshot(` | |
| { | |
| "issues": [ | |
| { | |
| "code": "invalid_type", | |
| "expected": "string", | |
| "message": "Invalid input: expected string, received number", | |
| "path": [], | |
| }, | |
| ], | |
| } | |
| `); | |
| }); | |
| test("length checks", async () => { | |
| const schema = z.string().refine(async (val) => val.length > 5); | |
| const result = await schema["~standard"].validate("234134134"); | |
| expect(result).toMatchInlineSnapshot(` | |
| { | |
| "value": "234134134", | |
| } | |
| `); | |
| }); | |
Xet Storage Details
- Size:
- 1.37 kB
- Xet hash:
- e4da413efce4817838d10eaae6dd13f3ce1516a92fd8d91f364d5e4f35a947c4
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.