download
raw
591 Bytes
import { expect, test } from "vitest";
import * as z from "zod/v4";
test(".nullable()", () => {
const nullable = z.string().nullable();
expect(nullable.parse(null)).toBe(null);
expect(nullable.parse("asdf")).toBe("asdf");
expect(() => nullable.parse(123)).toThrow();
});
test(".nullable unwrap", () => {
const schema = z.string().nullable();
expect(schema).toBeInstanceOf(z.ZodNullable);
expect(schema.unwrap()).toBeInstanceOf(z.ZodString);
});
test("z.null", () => {
const n = z.null();
expect(n.parse(null)).toBe(null);
expect(() => n.parse("asdf")).toThrow();
});

Xet Storage Details

Size:
591 Bytes
·
Xet hash:
1df4000e0a85a4aa61763c8b10861d6cddff94de4d80ef901f783c27171eccde

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.