Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
591 B
Text
22 lines
591 B
Text
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();
|
|
});
|