Page MenuHomeSealhub

jdd.test.ts
No OneTemporary

jdd.test.ts

import assert from "assert";
import { Markdown } from "./components/markdown.js";
import { JDD } from "./jdd.js";
import { Registry } from "./registry.js";
import { simplestContext } from "./test-utils/simplest-context.js";
describe("jdd", () => {
it("properly extracts headings from multiple components", () => {
const registry = new Registry();
registry.add("markdown", Markdown);
const jdd = JDD.fromParsed(registry, simplestContext(), [
{
component_name: "markdown",
args: {
markdown: `
# heading one
## heading two
### heading three`,
},
},
{
component_name: "markdown",
args: {
markdown: `
# heading four
`,
},
},
]);
assert.deepEqual(jdd.getHeadings(), [
{ text: "heading one", level: 1, slug: "heading-one" },
{ text: "heading two", level: 2, slug: "heading-two" },
{ text: "heading three", level: 3, slug: "heading-three" },
{ text: "heading four", level: 1, slug: "heading-four" },
]);
});
});

File Metadata

Mime Type
text/x-java
Expires
Tue, Dec 24, 14:02 (11 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557243
Default Alt Text
jdd.test.ts (979 B)

Event Timeline