Files
klz-cables.com/.pnpm-store/v10/files/05/5a9191a7fa9d49a3c5ead9c6df93041316f03c3bf27467ff8c29de1139a7aa57bb1b7a5e2250a5e4f31dfdf3c66727189c19af96be3b6a76c81e4ddb5032a8
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

58 lines
1.3 KiB
Plaintext

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",
}
`);
});