-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.js
74 lines (57 loc) · 1.87 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// imports
const Configuration = require("./index.js")
const config = new Configuration("config.txt")
// getRawProperty
test("getRawProperty", async() => {
let property = undefined
expect.assertions(5)
property = await config.getRawProperty("a")
expect(property).toBe("Hello")
property = await config.getRawProperty("b")
expect(property).toBe("world")
property = await config.getRawProperty("c")
expect(property).toBe("${a} ${b}")
property = await config.getRawProperty("d")
expect(property).toBe("${c}, it's @bradgarropy.")
property = await config.getRawProperty("e")
expect(property).toBe("")
})
// getRawProperties
test("getRawProperties", async() => {
expect.assertions(1)
const properties = await config.getRawProperties()
expect(properties).toEqual({
a: "Hello",
b: "world",
c: "${a} ${b}",
d: "${c}, it's @bradgarropy.",
e: "",
})
})
// getInterpolatedProperty
test("getInterpolatedProperty", async() => {
let property = undefined
expect.assertions(5)
property = await config.getInterpolatedProperty("a")
expect(property).toBe("Hello")
property = await config.getInterpolatedProperty("b")
expect(property).toBe("world")
property = await config.getInterpolatedProperty("c")
expect(property).toBe("Hello world")
property = await config.getInterpolatedProperty("d")
expect(property).toBe("Hello world, it's @bradgarropy.")
property = await config.getInterpolatedProperty("e")
expect(property).toBe("")
})
// getInterpolatedProperties
test("getInterpolatedProperties", async() => {
expect.assertions(1)
const properties = await config.getInterpolatedProperties()
expect(properties).toEqual({
a: "Hello",
b: "world",
c: "Hello world",
d: "Hello world, it's @bradgarropy.",
e: "",
})
})