Files
community-rule/tests/unit/isValidCreateFlowSaveEmail.test.ts
T
adilalloandCursor 42d83c8b62 Give builder fields persistent labels, treat description as optional, and validate save-progress email with a real form.
Name stays required; description is a labelled optional textarea. Email uses native validity and form submit. Drop the dead workshop link and fix a few copy errors.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 11:37:41 -06:00

22 lines
916 B
TypeScript

import { describe, it, expect } from "vitest";
import { isValidCreateFlowSaveEmail } from "../../lib/create/isValidCreateFlowSaveEmail";
describe("isValidCreateFlowSaveEmail", () => {
it("rejects empty, whitespace, and non-string values", () => {
expect(isValidCreateFlowSaveEmail("")).toBe(false);
expect(isValidCreateFlowSaveEmail(" ")).toBe(false);
expect(isValidCreateFlowSaveEmail(null)).toBe(false);
expect(isValidCreateFlowSaveEmail(undefined)).toBe(false);
});
it("rejects values the native email control would reject", () => {
expect(isValidCreateFlowSaveEmail("not-an-email")).toBe(false);
expect(isValidCreateFlowSaveEmail("user@example.com ")).toBe(false);
expect(isValidCreateFlowSaveEmail(" user@example.com")).toBe(false);
});
it("accepts a required type=email value", () => {
expect(isValidCreateFlowSaveEmail("user@example.com")).toBe(true);
});
});