This repository has been archived by the owner on Jan 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathexamples.test.js
64 lines (58 loc) · 1.55 KB
/
examples.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
function run(name, options = "") {
const pwd = require("shelljs").pwd();
const exec = require("shelljs").exec;
const result = exec(
`cd ${pwd}/examples/${name} && node ../../index.js ${options}`,
{
silent: true
}
);
return result.stdout;
}
test("hello-world", () => {
expect(run("hello-world")).toMatch("hello world!");
});
describe("multiple-pipelines", () => {
test("all default steps", () => {
expect(run("multiple-pipelines")).toBe(`executing step in "ubuntu"
default step
executing step in "ubuntu"
step2 executed
executing step in "ubuntu"
step3 executed in ubuntu
`);
});
test("step2", () => {
expect(run("multiple-pipelines", "step2"))
.toBe(`executing step "step2" in "ubuntu"
step2 executed
`);
});
test("Step Three", () => {
expect(run("multiple-pipelines", '"Step Three"'))
.toBe(`executing step "Step Three" in "ubuntu"
step3 executed in ubuntu
`);
});
test("master_step_2", () => {
expect(
run("multiple-pipelines", "master_step_2 --pipeline branches:master")
).toBe(`executing step "master_step_2" in "ubuntu"
step2 in master branch
`);
});
test("** -> 'branch step 2'", () => {
expect(run("multiple-pipelines", '"branch step 2" --pipeline branches:**'))
.toBe(`executing step "branch step 2" in "ubuntu"
step2 in any branch
`);
});
test("all master steps", () => {
expect(run("multiple-pipelines", "--pipeline branches:master"))
.toBe(`executing step in "ubuntu"
default step in master branch
executing step in "ubuntu"
step2 in master branch
`);
});
});