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
30 lines
778 B
Plaintext
30 lines
778 B
Plaintext
// @ts-ignore TS6133
|
||
import { expect, test } from "vitest";
|
||
|
||
import * as z from "zod/v3";
|
||
|
||
const RealSet = Set;
|
||
const RealMap = Map;
|
||
const RealDate = Date;
|
||
|
||
test("doesn’t throw when Date is undefined", () => {
|
||
delete (globalThis as any).Date;
|
||
const result = z.object({}).safeParse({});
|
||
expect(result.success).toEqual(true);
|
||
globalThis.Date = RealDate;
|
||
});
|
||
|
||
test("doesn’t throw when Set is undefined", () => {
|
||
delete (globalThis as any).Set;
|
||
const result = z.object({}).safeParse({});
|
||
expect(result.success).toEqual(true);
|
||
globalThis.Set = RealSet;
|
||
});
|
||
|
||
test("doesn’t throw when Map is undefined", () => {
|
||
delete (globalThis as any).Map;
|
||
const result = z.object({}).safeParse({});
|
||
expect(result.success).toEqual(true);
|
||
globalThis.Map = RealMap;
|
||
});
|