Page MenuHomeSealhub

markdown.test.ts
No OneTemporary

markdown.test.ts

import { Registry } from "../registry.js";
import { Markdown } from "./markdown.js";
import { JDDocument, makeSimpleJDDContext, render } from "../index.js";
import assert from "assert";
import { streamToString } from "tempstream";
import { FileManager } from "@sealcode/file-manager";
describe("markdown component", () => {
it("renders as a part of a JDD", async () => {
const document = [
{ component_name: "markdown", args: { markdown: `# Hello World` } },
{
component_name: "markdown",
args: { markdown: `Multiple components ftw` },
},
] as JDDocument;
const registry = new Registry();
registry.add("markdown", Markdown);
const result = await streamToString(
render(
registry,
document,
makeSimpleJDDContext(new FileManager("/tmp", "/uploaded_files"))
)
);
assert.strictEqual(
result,
`<h1>Hello World</h1>\n\n<p>Multiple components ftw</p>\n`
);
});
});

File Metadata

Mime Type
text/x-java
Expires
Sat, Oct 11, 07:46 (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
982287
Default Alt Text
markdown.test.ts (919 B)

Event Timeline