team-1/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts
2025-08-01 21:10:03 +02:00

29 lines
778 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// @ts-ignore TS6133
import { expect, test } from "vitest";
import * as z from "zod/v3";
const RealSet = Set;
const RealMap = Map;
const RealDate = Date;
test("doesnt throw when Date is undefined", () => {
delete (globalThis as any).Date;
const result = z.object({}).safeParse({});
expect(result.success).toEqual(true);
globalThis.Date = RealDate;
});
test("doesnt throw when Set is undefined", () => {
delete (globalThis as any).Set;
const result = z.object({}).safeParse({});
expect(result.success).toEqual(true);
globalThis.Set = RealSet;
});
test("doesnt throw when Map is undefined", () => {
delete (globalThis as any).Map;
const result = z.object({}).safeParse({});
expect(result.success).toEqual(true);
globalThis.Map = RealMap;
});