silverbullet/plugs/markdown/html_render.test.ts

30 lines
538 B
TypeScript
Raw Permalink Normal View History

2024-07-30 23:24:17 +08:00
import { assertEquals } from "@std/assert";
import { renderHtml } from "./html_render.ts";
Deno.test("HTML Render", () => {
assertEquals(
renderHtml({
name: "b",
body: "hello",
}),
`<b>hello</b>`,
);
assertEquals(
renderHtml({
name: "a",
attrs: {
href: "https://example.com",
},
body: "hello",
}),
`<a href="https://example.com">hello</a>`,
);
assertEquals(
renderHtml({
name: "span",
body: "<>",
}),
`<span>&lt;&gt;</span>`,
);
});