reformat + add testing utils, test dev plugin fully
This commit is contained in:
parent
0259a96937
commit
4d8a9dff8e
15 changed files with 242 additions and 158 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import { expect, test } from "bun:test";
|
||||
import MarkdownCompiler from "../markdown-compiler";
|
||||
|
||||
// Mock marked and parseMetadata for isolated testing
|
||||
const mockMarked = {
|
||||
parse: (text: string) => `<p>${text}</p>`,
|
||||
};
|
||||
|
|
@ -12,7 +11,6 @@ const mockParseMetadata = (file: string) => {
|
|||
return undefined;
|
||||
};
|
||||
|
||||
// Patch dependencies
|
||||
// @ts-expect-error
|
||||
MarkdownCompiler.prototype["marked"] = mockMarked;
|
||||
// @ts-expect-error
|
||||
|
|
@ -21,7 +19,7 @@ MarkdownCompiler.prototype["parseMetadata"] = mockParseMetadata;
|
|||
test("MarkdownCompiler compiles markdown to HTML", async () => {
|
||||
const plugin = new MarkdownCompiler();
|
||||
const input = "# Hello World";
|
||||
// Simulate marked.parse
|
||||
|
||||
const output = await plugin.rewriteFile(input, "test.md");
|
||||
expect(typeof output).toBe("string");
|
||||
expect(output).toContain("Hello World");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue