Archived
1
0
Fork 0

par(md): add more tests

This commit is contained in:
Dmitriy Pleshevskiy 2022-06-11 22:13:28 +03:00
parent ffb08ed9ee
commit ef1baea81b
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215

View file

@ -21,3 +21,26 @@ Deno.test({
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>");
},
});