-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdetermine-skips.test.js
More file actions
59 lines (49 loc) · 1.52 KB
/
determine-skips.test.js
File metadata and controls
59 lines (49 loc) · 1.52 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
57
58
59
const { determineSkips } = require("./find-python-projects.js");
describe("determineSkips", () => {
const GLOBAL_KEY = "__GLOBAL__";
it("puts command under the global key when no project is specified", () => {
const input = `
command=test
`;
expect(determineSkips(input)).toEqual({ [GLOBAL_KEY]: ["test"] });
});
it("uses project name as key and command as value when both are provided", () => {
const input = `
project=my_project,command=package
`;
expect(determineSkips(input)).toEqual({ my_project: ["package"] });
});
it("handles multiple lines: global + project", () => {
const input = `
command=test
project=my_project,command=package
`;
expect(determineSkips(input)).toEqual({
[GLOBAL_KEY]: ["test"],
my_project: ["package"],
});
});
it("trims whitespace and ignores empty lines", () => {
const input = `
command= build
project=alpha , command=deploy
`;
expect(determineSkips(input)).toEqual({
[GLOBAL_KEY]: ["build"],
alpha: ["deploy"],
});
});
it("append more entries when the same project appears multiple times", () => {
const input = `
project=alpha,command=build
project=alpha,command=test
`;
expect(determineSkips(input)).toEqual({ alpha: ["build", "test"] });
});
it("falls back to the raw line when neither project nor command is present", () => {
const input = "test";
expect(determineSkips(input)).toEqual({
[GLOBAL_KEY]: ["test"],
});
});
});