This repository was archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 674
Expand file tree
/
Copy pathargs.test.ts
More file actions
56 lines (48 loc) · 1.36 KB
/
args.test.ts
File metadata and controls
56 lines (48 loc) · 1.36 KB
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
import assert from "assert";
import args from "../src/args";
describe("args", () => {
describe("detach", () => {
const versionString = "Version string";
const isDocker = false;
const detachModeArgs = ["--detach", "--D", "--😈"];
const notDetachModeArgs = [
"--no-detach",
"--no-D",
"--no-😈",
"--detach=false",
"--D=false",
"--😈=false"
];
it("defaults to false when no arg provided", () => {
const rawArgs = [];
const options = args(versionString, isDocker, rawArgs);
assert.strictEqual(
options.detach,
false,
`Expected "options.detach" to be false when no argument is provided`
);
});
detachModeArgs.forEach(arg => {
it(`is true with ${arg}`, () => {
const rawArgs = [arg];
const options = args(versionString, false, rawArgs);
assert.strictEqual(
options.detach,
true,
`Expected "options.detach" to be true with arg ${arg}`
);
});
});
notDetachModeArgs.forEach(arg => {
it(`is false with ${arg}`, () => {
const rawArgs = [arg];
const options = args(versionString, false, rawArgs);
assert.strictEqual(
options.detach,
false,
`Expected "options.detach" to be false with arg ${arg}`
);
});
});
});
});