1
0
silverbullet/plug-api/lib/query.test.ts
Zef Hemel aaebea5e54
Major directive refactor (#195)
Fixes #188 #144 #76: major refactor of directive parsing, rendering, styling
2022-12-14 20:04:20 +01:00

26 lines
756 B
TypeScript

import { renderToText } from "./tree.ts";
import wikiMarkdownLang from "../../common/markdown_parser/parser.ts";
import { assert, assertEquals } from "../../test_deps.ts";
import { parse } from "../../common/markdown_parser/parse_tree.ts";
import { removeQueries } from "./query.ts";
const queryRemovalTest = `
# Heading
Before
<!-- #query page -->
Bla bla remove me
<!-- /query -->
End
`;
Deno.test("White out queries", () => {
const lang = wikiMarkdownLang([]);
const mdTree = parse(lang, queryRemovalTest);
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);
});