Files
klz-cables.com/.pnpm-store/v10/files/12/5fda673b5afbcc26514eebdc8eef4af252c512777ba4a288ccac470f13b50913daa77a4b82ff898b7d52583c72b9a83d56bd39abf1abe12cf86120cda91442
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

47 lines
1.1 KiB
Plaintext

import { expect, expectTypeOf, test } from "vitest";
import * as z from "zod/v3";
test("test", () => {
expect(true).toBe(true);
});
test("test2", () => {
expect(() => z.string().parse(234)).toThrowErrorMatchingInlineSnapshot(`
[ZodError: [
{
"code": "invalid_type",
"expected": "string",
"received": "number",
"path": [],
"message": "Expected string, received number"
}
]]
`);
});
test("async validation", async () => {
const testTuple = z
.tuple([z.string().refine(async () => true), z.number().refine(async () => true)])
.refine(async () => true);
expectTypeOf<typeof testTuple._output>().toEqualTypeOf<[string, number]>();
const val = await testTuple.parseAsync(["asdf", 1234]);
expect(val).toEqual(val);
const r1 = await testTuple.safeParseAsync(["asdf", "asdf"]);
expect(r1.success).toEqual(false);
expect(r1.error!).toMatchInlineSnapshot(`
[ZodError: [
{
"code": "invalid_type",
"expected": "number",
"received": "string",
"path": [
1
],
"message": "Expected number, received string"
}
]]
`);
});