Skip to content

Commit dd33ec4

Browse files
committed
(feat) add tests
Signed-off-by: Muthu Kumar <muthukumar@thefeathers.in>
1 parent adb5987 commit dd33ec4

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"deno.enable": true,
33
"deno.lint": true,
4-
"deno.unstable": true
4+
"deno.unstable": true,
5+
"deno.suggest.imports.hosts": {
6+
"https://deno.land": true
7+
}
58
}

test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { assertEquals } from "https://deno.land/std@0.99.0/testing/asserts.ts";
2+
3+
import { elements, renderHTML } from "./mod.ts";
4+
5+
const [div, p, h1, br] = elements("div", "p", "h1", "br");
6+
7+
Deno.test({
8+
name: "renderHTML simple",
9+
fn: () => {
10+
assertEquals(
11+
renderHTML(div({ id: "hello", class: "world" }, "Hello world")),
12+
`<div id="hello" class="world">Hello world</div>`,
13+
);
14+
},
15+
});
16+
17+
Deno.test({
18+
name: "renderHTML complex",
19+
fn: () => {
20+
assertEquals(
21+
renderHTML(
22+
div(
23+
{ id: "hello", class: "world" },
24+
p(h1({ class: "hello" }, "hello world", br())),
25+
),
26+
),
27+
`<div id="hello" class="world"><p><h1 class="hello">hello world<br /></h1></p></div>`,
28+
);
29+
},
30+
});

0 commit comments

Comments
 (0)