26 lines
1.1 KiB
TypeScript
26 lines
1.1 KiB
TypeScript
import { expect, test } from "bun:test";
|
|
import { emailEditorBlocks } from "../src/create.ts";
|
|
import { emailPresets } from "../src/presets.ts";
|
|
|
|
test("published email editor content factories return valid independent instances", () => {
|
|
let id = 0;
|
|
for (const definition of emailEditorBlocks.filter(block => block.manifest.category === "content")) {
|
|
const first = definition.create({ id: () => String(++id) });
|
|
const second = definition.create({ id: () => String(++id) });
|
|
expect(first.id).not.toBe(second.id);
|
|
expect(definition.manifest.props.parse(first.props).ok).toBe(true);
|
|
expect(first.type).toBe(definition.manifest.type);
|
|
}
|
|
});
|
|
test("published presets expose metadata and remap all instance IDs on creation", () => {
|
|
let id = 0;
|
|
for (const preset of emailPresets) {
|
|
const first = preset.create({ id: () => String(++id) });
|
|
const second = preset.create({ id: () => String(++id) });
|
|
expect(preset.name.key).toBeTruthy();
|
|
expect(preset.icon).toBeTruthy();
|
|
expect(first.type).toBe("layout.section");
|
|
expect(first.id).not.toBe(second.id);
|
|
}
|
|
});
|