Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
crowlKats committed Nov 15, 2024
1 parent add27bf commit 5eb2e78
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions js/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ interface GenerateOptions {
filePath: ShortPath | undefined,
anchorizer: (content: string, depthLevel: number) => string,
): string | undefined;
/** Function to strip markdown. */
markdownStripper(md: string): string;
}

Expand Down
27 changes: 26 additions & 1 deletion js/test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { assert, assertEquals, assertRejects } from "jsr:@std/[email protected]";
import { doc } from "./mod.ts";
import { doc, generateHtml, ShortPath } from "./mod.ts";

Deno.test({
name: "doc()",
Expand Down Expand Up @@ -123,3 +123,28 @@ Deno.test({
assertEquals(entries[0].name, "B");
},
});

Deno.test({
name: "generateHtml()",
async fn() {
const entries = await doc(
"https://deno.land/[email protected]/fmt/colors.ts",
);

const files = await generateHtml({
markdownRenderer(
md,
_titleOnly,
_filePath,
_anchorizer,
) {
return md;
},
markdownStripper(md: string) {
return md;
},
}, { ["file:///colors.ts"]: entries });

assertEquals(Object.keys(files).length, 61);
},
});

0 comments on commit 5eb2e78

Please sign in to comment.