mirror of
https://github.com/hex248/ob248.com.git
synced 2026-02-08 10:43:38 +00:00
merge new into master
This commit is contained in:
24
node_modules/zod/src/v3/tests/nan.test.ts
generated
vendored
Normal file
24
node_modules/zod/src/v3/tests/nan.test.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// @ts-ignore TS6133
|
||||
import { expect, test } from "vitest";
|
||||
|
||||
import * as z from "zod/v3";
|
||||
|
||||
const schema = z.nan();
|
||||
|
||||
test("passing validations", () => {
|
||||
const result1 = schema.parse(Number.NaN);
|
||||
expect(Number.isNaN(result1)).toBe(true);
|
||||
|
||||
const result2 = schema.parse(Number("Not a number"));
|
||||
expect(Number.isNaN(result2)).toBe(true);
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
Reference in New Issue
Block a user