-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.mjs
34 lines (24 loc) · 832 Bytes
/
test.mjs
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
// @ts-check
import { strictEqual } from "node:assert";
import TestDirector from "test-director";
import fakeTag from "./fakeTag.mjs";
const tests = new TestDirector();
tests.add("`fakeTag` with an empty template literal.", () => {
strictEqual(fakeTag``, "");
});
tests.add("`fakeTag` with literal escapes.", () => {
strictEqual(fakeTag`\``, "`");
});
tests.add("`fakeTag` with only a literal.", () => {
strictEqual(fakeTag`1`, "1");
});
tests.add("`fakeTag` with only embedded expressions.", () => {
strictEqual(fakeTag`${1}${2}${3}`, "123");
});
tests.add("`fakeTag` with embedded expressions surrounding a literal.", () => {
strictEqual(fakeTag`${1}2${3}`, "123");
});
tests.add("`fakeTag` with literals surrounding embedded expressions.", () => {
strictEqual(fakeTag`1${2}${3}4`, "1234");
});
tests.run();