Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -0,0 +1,54 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
applyFieldMapping,
|
||||
FieldTypeSchema,
|
||||
FormDefinitionSchema,
|
||||
FormFieldSchema,
|
||||
FormSubmissionPayloadSchema,
|
||||
FormThemeSchema,
|
||||
HONEYPOT_FIELD_KEY,
|
||||
isHoneypotTriggered,
|
||||
matchAllowedOrigin,
|
||||
normalizeOrigin,
|
||||
resolveSubmissionTarget,
|
||||
} from "./index.js";
|
||||
|
||||
/**
|
||||
* Public-API barrel smoke test. Verifies that every export is wired to the
|
||||
* correct implementation — a forgotten or renamed re-export in index.ts
|
||||
* would surface here rather than at a downstream import site.
|
||||
*/
|
||||
describe("@hivegrid/form-widget barrel", () => {
|
||||
it("re-exports the honeypot field key constant", () => {
|
||||
expect(HONEYPOT_FIELD_KEY).toBe("hp_extra_data");
|
||||
});
|
||||
|
||||
it("re-exports the field-type enum schema", () => {
|
||||
expect(FieldTypeSchema.parse("email")).toBe("email");
|
||||
expect(FieldTypeSchema.safeParse("file").success).toBe(true);
|
||||
expect(FieldTypeSchema.safeParse("radio").success).toBe(false);
|
||||
});
|
||||
|
||||
it("re-exports the origin helpers", () => {
|
||||
expect(normalizeOrigin("Example.com")).toBe("https://example.com");
|
||||
expect(matchAllowedOrigin("https://example.com", ["example.com"])).toBe(true);
|
||||
});
|
||||
|
||||
it("re-exports the honeypot helper", () => {
|
||||
expect(isHoneypotTriggered({ [HONEYPOT_FIELD_KEY]: "spam" })).toBe(true);
|
||||
});
|
||||
|
||||
it("re-exports the routing helpers", () => {
|
||||
expect(resolveSubmissionTarget({}).type).toBe("generic");
|
||||
expect(applyFieldMapping({ payload: { a: 1 } })).toEqual({ a: 1 });
|
||||
});
|
||||
|
||||
it("re-exports the Zod schemas", () => {
|
||||
expect(FormFieldSchema.safeParse({ key: "name", type: "text", label: "Name" }).success).toBe(true);
|
||||
expect(FormThemeSchema.safeParse({ primaryColor: "#fff" }).success).toBe(true);
|
||||
expect(FormDefinitionSchema.safeParse({ title: "C", fields: [{ key: "n", type: "text", label: "N" }] }).success).toBe(
|
||||
true,
|
||||
);
|
||||
expect(FormSubmissionPayloadSchema.safeParse({ values: {} }).success).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user