Files
klz-cables.com/.pnpm-store/v10/files/14/107e3da06cf479695c5f54e24ac0cd3f1d5bdb7b2a34b03e04fb99969f1aa8b697e1bb142a656dc4d88a3e262e303920b002966c5e6eb97d0d8c1595214d19
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

109 lines
3.2 KiB
Plaintext

import { test } from "vitest";
// import * as z from "zod/v4";
test(() => {});
// test("overload types", () => {
// const schema = z.string().json();
// util.assertEqual<typeof schema, z.ZodString>(true);
// const schema2 = z.string().json(z.number());
// util.assertEqual<typeof schema2, z.ZodPipe<z.ZodTransform<any, string>, z.ZodNumber>>(true);
// const r2 = schema2.parse("12");
// util.assertEqual<number, typeof r2>(true);
// });
// test("parse string to json", async () => {
// const Env = z.object({
// myJsonConfig: z.string().jsonString(z.object({ foo: z.number() })),
// someOtherValue: z.string(),
// });
// expect(
// Env.parse({
// myJsonConfig: '{ "foo": 123 }',
// someOtherValue: "abc",
// })
// ).toEqual({
// myJsonConfig: { foo: 123 },
// someOtherValue: "abc",
// });
// const invalidValues = Env.safeParse({
// myJsonConfig: '{"foo": "not a number!"}',
// someOtherValue: null,
// });
// expect(JSON.parse(JSON.stringify(invalidValues))).toEqual({
// success: false,
// error: {
// name: "ZodError",
// issues: [
// {
// code: "invalid_type",
// expected: "number",
// input: "not a number!",
// received: "string",
// path: ["myJsonConfig", "foo"],
// message: "Expected number, received string",
// },
// {
// code: "invalid_type",
// expected: "string",
// input: null,
// received: "null",
// path: ["someOtherValue"],
// message: "Expected string, received null",
// },
// ],
// },
// });
// const invalidJsonSyntax = Env.safeParse({
// myJsonConfig: "This is not valid json",
// someOtherValue: null,
// });
// expect(JSON.parse(JSON.stringify(invalidJsonSyntax))).toMatchObject({
// success: false,
// error: {
// name: "ZodError",
// issues: [
// {
// code: "invalid_string",
// input: {
// _def: {
// catchall: {
// _def: {
// typeName: "ZodNever",
// },
// },
// typeName: "ZodObject",
// unknownKeys: "strip",
// },
// },
// validation: "json",
// message: "Invalid json",
// path: ["myJsonConfig"],
// },
// {
// code: "invalid_type",
// expected: "string",
// input: null,
// received: "null",
// path: ["someOtherValue"],
// message: "Expected string, received null",
// },
// ],
// },
// });
// });
// test("no argument", () => {
// const schema = z.string().json();
// util.assertEqual<typeof schema, z.ZodString>(true);
// z.string().json().parse(`{}`);
// z.string().json().parse(`null`);
// z.string().json().parse(`12`);
// z.string().json().parse(`{ "test": "test"}`);
// expect(() => z.string().json().parse(`asdf`)).toThrow();
// expect(() => z.string().json().parse(`{ "test": undefined }`)).toThrow();
// expect(() => z.string().json().parse(`{ "test": 12n }`)).toThrow();
// expect(() => z.string().json().parse(`{ test: "test" }`)).toThrow();
// });