Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/Functions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,26 @@ describe("convertMarkdownToHtml", () => {
);
expect(() => convertMarkdownToHtml(123)).toThrow("Markdown parse error");
});

it("converts complex markdown with multiple elements", () => {
const md = `
# Title

This is a paragraph with **bold** text and a [link](https://example.com).

- List item 1
- List item 2

> A blockquote
`;
const html = convertMarkdownToHtml(md);
expect(html).toContain("<h1>Title</h1>");
expect(html).toContain(
'<p>This is a paragraph with <strong>bold</strong> text and a <a href="https://example.com">link</a>.</p>',
);
expect(html).toContain(
"<ul>\n<li>List item 1</li>\n<li>List item 2</li>\n</ul>",
);
expect(html).toContain("<blockquote>\n<p>A blockquote</p>\n</blockquote>");
});
});
10 changes: 8 additions & 2 deletions tests/test.setup.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
import { randomUUID } from "node:crypto"; // Node.js built-in crypto
global.crypto = { randomUUID }; // Mock or polyfill necessary crypto functions
import { randomUUID } from "node:crypto";

if (!globalThis.crypto?.randomUUID) {
Object.defineProperty(globalThis, "crypto", {
value: { randomUUID },
configurable: true,
});
}