test: add comprehensive automated test coverage
- Vitest multi-project setup (unit / integration / component) - Real-Postgres integration harness via in-process PGlite (TEST_DATABASE_URL override), migrations applied per worker; production code untouched - Unit: routing, locale, validation/Zod schemas, metadata, mail, site-theme, marquee, media, portfolio helpers, plus architecture-rule tests - Integration: Prisma data layer, API routes, and all server actions - Component: UI primitives and form components (jsdom + Testing Library) - 371 tests passing
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { isCheckedFormValue } from "@/lib/form-data";
|
||||
|
||||
describe("isCheckedFormValue", () => {
|
||||
it("treats standard checkbox values as checked", () => {
|
||||
expect(isCheckedFormValue("on")).toBe(true);
|
||||
expect(isCheckedFormValue("true")).toBe(true);
|
||||
expect(isCheckedFormValue("1")).toBe(true);
|
||||
});
|
||||
|
||||
it("treats other values as unchecked", () => {
|
||||
expect(isCheckedFormValue("off")).toBe(false);
|
||||
expect(isCheckedFormValue("false")).toBe(false);
|
||||
expect(isCheckedFormValue("0")).toBe(false);
|
||||
expect(isCheckedFormValue("")).toBe(false);
|
||||
expect(isCheckedFormValue(null)).toBe(false);
|
||||
expect(isCheckedFormValue("yes")).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user