-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_test.tsx
47 lines (36 loc) · 1.4 KB
/
mod_test.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { assertMatch } from "https://deno.land/[email protected]/assert/mod.ts";
import { generate } from "./mod.tsx";
Deno.test("generates svg & its elements", async () => {
const result = await generate();
assertMatch(result, /<svg[^>]*>/);
assertMatch(result, /<rect[^>]*>/);
assertMatch(result, /<text[^>]*>/);
});
Deno.test("generates with default width and height", async () => {
const result = await generate();
assertMatch(result, /width="200"/);
assertMatch(result, /height="200"/);
assertMatch(result, /viewBox="0 0 200 200"/);
});
Deno.test("generates with custom width and height", async () => {
const result = await generate({ width: 300, height: 400 });
assertMatch(result, /width="300"/);
assertMatch(result, /height="400"/);
assertMatch(result, /viewBox="0 0 300 400"/);
});
Deno.test("generates with custom text", async () => {
const result = await generate({ text: "hello" });
assertMatch(result, /hello/);
});
Deno.test("generates with custom font", async () => {
const result = await generate({ font: "Arial" });
assertMatch(result, /font-family="Arial"/);
});
Deno.test("generates with custom color", async () => {
const result = await generate({ color: "red" });
assertMatch(result, /fill="red"/);
});
Deno.test("generates with custom background color", async () => {
const result = await generate({ bgcolor: "orange" });
assertMatch(result, /fill="orange"/);
});