feat: release design system engine, studio and component contracts

This commit is contained in:
Clintchiz committed 2026-10-19 13:09:03 +05:30
1 parent ff1065fb27
commit 3943b946d6
693 files changed
+175546 -3894

No files matched your search

+15 -5
View File
@@ -2,9 +2,19 @@ import { expect, test } from "bun:test";
import { renderRichText, richTextSchema } from "../src/rich-text.ts";
test("semantic text is escaped, bounded, and rejects arbitrary markup properties", () => {
expect(renderRichText({text:"<hello>\nworld",richText:[{text:"<hello>",bold:true},{text:"\nworld",italic:true,underline:true}]})).toBe("<strong>&lt;hello&gt;</strong><em><u><br />world</u></em>");
expect(richTextSchema.parse([{text:"hello",html:"<script>"}]).ok).toBe(false);
expect(richTextSchema.parse([{text:"hello",bold:"yes"}]).ok).toBe(false);
expect(richTextSchema.parse([{text:"a".repeat(200001)}]).ok).toBe(false);
expect(renderRichText({text:"Changed",richText:[{text:"Old",bold:true}]})).toBe("Changed");
expect(
renderRichText({
text: "<hello>\nworld",
richText: [
{ text: "<hello>", bold: true },
{ text: "\nworld", italic: true, underline: true },
],
}),
).toBe("<strong>&lt;hello&gt;</strong><em><u><br />world</u></em>");
expect(richTextSchema.parse([{ text: "hello", html: "<script>" }]).ok).toBe(false);
expect(richTextSchema.parse([{ text: "hello", bold: "yes" }]).ok).toBe(false);
expect(richTextSchema.parse([{ text: "a".repeat(200001) }]).ok).toBe(false);
expect(renderRichText({ text: "Changed", richText: [{ text: "Old", bold: true }] })).toBe(
"Changed",
);
});