par(md): add more tests
This commit is contained in:
parent
ffb08ed9ee
commit
ef1baea81b
1 changed files with 23 additions and 0 deletions
|
@ -21,3 +21,26 @@ Deno.test({
|
||||||
assertEquals(ren.render(res), "<h1>hello</h1>");
|
assertEquals(ren.render(res), "<h1>hello</h1>");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Deno.test({
|
||||||
|
name: "should parse header with specific level",
|
||||||
|
fn: () => {
|
||||||
|
const par = new MarkdownParser();
|
||||||
|
assertEquals(ren.render(par.parse("# hello")), "<h1>hello</h1>");
|
||||||
|
assertEquals(ren.render(par.parse("## hello")), "<h2>hello</h2>");
|
||||||
|
assertEquals(ren.render(par.parse("### hello")), "<h3>hello</h3>");
|
||||||
|
assertEquals(ren.render(par.parse("#### hello")), "<h4>hello</h4>");
|
||||||
|
assertEquals(ren.render(par.parse("##### hello")), "<h5>hello</h5>");
|
||||||
|
assertEquals(ren.render(par.parse("###### hello")), "<h6>hello</h6>");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Deno.test({
|
||||||
|
name: "should parse header if line contains additional spaces",
|
||||||
|
fn: () => {
|
||||||
|
const par = new MarkdownParser();
|
||||||
|
assertEquals(ren.render(par.parse(" # hello")), "<h1>hello</h1>");
|
||||||
|
assertEquals(ren.render(par.parse(" # hello")), "<h1>hello</h1>");
|
||||||
|
assertEquals(ren.render(par.parse(" # hello")), "<h1>hello</h1>");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
Reference in a new issue