Files
EpicNext-Cms/src/lib/form-data.test.ts
T
openhands df38dccbf1
Local Build and Deploy / deploy (push) Failing after 46s
style: format code biome
2026-07-13 21:57:41 +02:00

25 lines
560 B
TypeScript

import { describe, expect, it } from "vitest";
import { formPositiveBigInt } from "@/lib/form-data";
describe("formPositiveBigInt", () => {
it("parses a positive identifier from FormData", () => {
const formData = new FormData();
formData.set("id", "42");
expect(formPositiveBigInt(formData, "id")).toBe(42n);
});
it.each([
"",
"0",
"-1",
"1.5",
"invalid",
])("rejects invalid identifier %s", (value) => {
const formData = new FormData();
formData.set("id", value);
expect(formPositiveBigInt(formData, "id")).toBeNull();
});
});