deno.land / x / zod@v3.19.1 / __tests__ / nan.test.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// @ts-ignore TS6133import { expect } from "https://deno.land/x/expect@v0.2.6/mod.ts";const test = Deno.test;
import * as z from "../index.ts";
const schema = z.nan();
test("passing validations", () => { schema.parse(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();});
zod

Version Info

Tagged at
a year ago