-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.test.js
48 lines (36 loc) · 1.15 KB
/
index.test.js
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
48
/*global test*/
const assert = require("assert");
const {
getCommentLabel,
makeMessage,
} = require("./label-messager");
test("test makeMessage", () => {
const expected = `
#### Label Messager: wasmtime:config
This is a message for you
--------------------------------------------------------------------------------
<details>
To modify this label's message, edit the <code>.github/label-messager/wasmtime-config.md</code> file.
To add new label messages or remove existing label messages, edit the
<code>.github/label-messager.json</code> configuration file.
[Learn more.](https://github.com/bytecodealliance/label-messager-action)
</details>
`.trim();
const observed = makeMessage(
".github/label-messager.json",
".github/label-messager/wasmtime-config.md",
"wasmtime:config",
"This is a message for you"
);
assert.equal(expected, observed);
});
test("test getCommentLabel", () => {
const comment = makeMessage(
".github/label-messager",
".github/label-messager/wasmtime:config",
"wasmtime:config",
"This is a message for you"
);
const label = getCommentLabel(comment);
assert.equal(label, "wasmtime:config");
});