-
Notifications
You must be signed in to change notification settings - Fork 0
/
argvTest.js
48 lines (40 loc) · 872 Bytes
/
argvTest.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
/* eslint-env jest */
var dot
beforeEach(function() {
dot = require("dot-event")()
require("@dot-event/store")(dot)
require("./argv")(dot)
})
test("args from array", function() {
expect.assertions(1)
return dot("argv", "test", {
args: ["a", "-b", "--c=d"],
save: true,
}).then(function() {
expect(dot.get("test")).toEqual({
_: ["a"],
b: true,
c: "d",
})
})
})
test("args from process", function() {
expect.assertions(1)
return dot.argv("test", { save: true }).then(function() {
expect(dot.get("test")).toEqual({ _: [] })
})
})
test("args with alias", function() {
expect.assertions(1)
return dot("argv", "test", {
alias: { hi: "hello" },
args: ["--hi"],
save: true,
}).then(function() {
expect(dot.get("test")).toEqual({
_: [],
hello: true,
hi: true,
})
})
})