Files
NapCatQQ/.pnpm-store/v3/files/5c/a544b2c196f3b03ea9278e89c90d0a36007477fb426e99ca3064e852a8c49e934e71afca412392ba35a0d566ea3967439944580ca6429bcec5a42d63387372
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

22 lines
587 B
Plaintext

// @ts-ignore TS6133
import { expect, test } from "vitest";
import * as z from "zod/v3";
const schema = z.nan();
test("passing validations", () => {
schema.parse(Number.NaN);
schema.parse(Number("Not a number"));
});
test("failing validations", () => {
expect(() => schema.parse(5)).toThrow();
expect(() => schema.parse("John")).toThrow();
expect(() => schema.parse(true)).toThrow();
expect(() => schema.parse(null)).toThrow();
expect(() => schema.parse(undefined)).toThrow();
expect(() => schema.parse({})).toThrow();
expect(() => schema.parse([])).toThrow();
});