2022-12-14 19:04:20 +00:00
|
|
|
import { renderToText } from "./tree.ts";
|
|
|
|
import { assert, assertEquals } from "../../test_deps.ts";
|
|
|
|
import { removeQueries } from "./query.ts";
|
2023-07-30 09:30:01 +00:00
|
|
|
import { parseMarkdown } from "$sb/lib/test_utils.ts";
|
2022-12-14 19:04:20 +00:00
|
|
|
|
|
|
|
const queryRemovalTest = `
|
|
|
|
# Heading
|
|
|
|
Before
|
|
|
|
<!-- #query page -->
|
|
|
|
Bla bla remove me
|
|
|
|
<!-- /query -->
|
|
|
|
End
|
|
|
|
`;
|
|
|
|
|
|
|
|
Deno.test("White out queries", () => {
|
2023-07-30 09:30:01 +00:00
|
|
|
const mdTree = parseMarkdown(queryRemovalTest);
|
2022-12-14 19:04:20 +00:00
|
|
|
removeQueries(mdTree);
|
|
|
|
const text = renderToText(mdTree);
|
|
|
|
// Same length? We should be good
|
|
|
|
assertEquals(text.length, queryRemovalTest.length);
|
|
|
|
assert(text.indexOf("remove me") === -1);
|
|
|
|
console.log("Whited out text", text);
|
|
|
|
});
|