Page MenuHomeSealhub

markdown.test.ts
No OneTemporary

markdown.test.ts

import { Registry } from "../registry.js";
import { Markdown } from "./markdown.js";
import {
documentContainerFromParsed,
makeSimpleEnglishJDDContext,
render,
} from "../index.js";
import assert from "assert";
import { streamToString } from "tempstream";
import { FileManager } from "@sealcode/file-manager";
import { formatWithPrettier } from "../test-utils/prettier.js";
describe("markdown component", () => {
it("renders as a part of a JDD", async () => {
const document = documentContainerFromParsed([
{ component_name: "markdown", args: { markdown: `# Hello World` } },
{
component_name: "markdown",
args: { markdown: `Multiple components ftw` },
},
]);
const registry = new Registry();
registry.add("markdown", Markdown);
const result = await render(
registry,
document,
makeSimpleEnglishJDDContext(
new FileManager("/tmp", "/uploaded_files")
)
);
assert.strictEqual(
await formatWithPrettier(result, "html"),
// note the soft hyphens
await formatWithPrettier(
/* HTML */ `<section class="jdd-component component-number-0">
<h1>Hello World</h1>
</section>
<section class="jdd-component component-number-1">
<p>Mul­ti­ple com­po­nents ftw</p>
</section>`,
"html"
)
);
});
});

File Metadata

Mime Type
text/x-java
Expires
Tue, Dec 24, 14:02 (20 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557149
Default Alt Text
markdown.test.ts (1 KB)

Event Timeline