feat: release design system engine, studio and component contracts
This commit is contained in:
1 parent
ff1065fb27
commit
3943b946d6
693 files changed
+175546
-3894
No files matched your search
@@ -4,15 +4,19 @@ import { emailCoreBlocks } from "../src/blocks.ts";
|
||||
|
||||
test("palette factory produces schema-valid independent blocks with injected IDs and time", () => {
|
||||
let sequence = 0;
|
||||
for (const definition of emailCoreBlocks.filter(block => /^(content|commerce)\./.test(block.manifest.type))) {
|
||||
for (const definition of emailCoreBlocks.filter((block) =>
|
||||
/^(content|commerce)\./.test(block.manifest.type),
|
||||
)) {
|
||||
const context = { id: () => `node-${++sequence}`, now: Date.parse("2026-09-05T00:00:00Z") };
|
||||
const first = createEmailBlock(definition.manifest.type, context), second = createEmailBlock(definition.manifest.type, context);
|
||||
const first = createEmailBlock(definition.manifest.type, context),
|
||||
second = createEmailBlock(definition.manifest.type, context);
|
||||
expect(definition.manifest.props.parse(first.props).ok).toBe(true);
|
||||
expect(first.id).not.toBe(second.id);
|
||||
expect(first.props).toEqual(second.props);
|
||||
expect(first.props).not.toBe(second.props);
|
||||
expect(first.version).toBe(definition.manifest.version);
|
||||
if (first.type === "content.countdown") expect(first.props.deadline).toBe("2026-09-06T00:00:00.000Z");
|
||||
if (first.type === "content.countdown")
|
||||
expect(first.props.deadline).toBe("2026-09-06T00:00:00.000Z");
|
||||
}
|
||||
expect(() => createEmailBlock("untrusted.block", { id: () => "id" })).toThrow();
|
||||
});
|
||||
Reference in new issue
Block a user