-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.test.js
76 lines (52 loc) · 1.85 KB
/
run.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
75
76
const run = require('./run');
describe('with pre-set CONAN_USERNAME', () => {
beforeAll(() => { process.env.CONAN_USERNAME = "john_doe"; });
test('get_username', () => { expect(run.get_username()).toBe("john_doe") });
afterAll(() => { delete process.env.CONAN_USERNAME; });
})
describe('with pre-set GITHUB_REPOSITORY', () => {
beforeAll(() => {
process.env.GITHUB_REPOSITORY = "willyw/chocolote-factory";
});
test('get_username', () => { expect(run.get_username()).toBe("willyw"); });
afterAll(() => { delete process.env.GITHUB_REPOSITORY; });
});
describe('with default install input', () => {
beforeAll(() => { process.env.INPUT_INSTALL = "latest"; });
test('get_cpt_version', () => {
expect(run.get_cpt_version()).toBe("conan_package_tools");
});
afterAll(() => { delete process.env.INPUT_INSTALL; });
})
describe('with custon install input', () => {
beforeAll(() => { process.env.INPUT_INSTALL = "1.20.0"; });
test('get_cpt_version', () => {
expect(run.get_cpt_version()).toBe("conan_package_tools==1.20.0");
});
afterAll(() => { delete process.env.INPUT_INSTALL; });
})
describe('with disabled install', () => {
beforeAll(() => { process.env.INPUT_INSTALL = "no"; });
test('get_cpt_version', () => {
expect(run.get_cpt_version()).toBe(null);
});
afterAll(() => { delete process.env.INPUT_INSTALL; });
})
describe('running', () => {
const cwd = process.cwd();
beforeAll(() => {
process.env.INPUT_INSTALL = "no";
process.env.CONAN_USERNAME = "john_doe";
process.env["INPUT_BUILD-SCRIPT"] = "build.py";
process.chdir("test");
});
test('run() runs', () => {
return run.run().then(() => { return true; });
});
afterAll(() => {
process.chdir(cwd);
delete process.env.INPUT_BUILD_SCRIPT;
delete process.env.CONAN_USERNAME;
delete process.env.INPUT_INSTALL;
});
});