Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrockhu committed Jan 2, 2021
1 parent 27a4ace commit 1794277
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions src/buildExec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,59 @@ test('no arguments', () => {
expect(filepath).toEqual('codecov.sh');
expect(fail_ci).toBeFalsy();
});

test('all arguments', () => {
const envs = {
"move_coverage_to_trash": "true",
"commit_parent": "83231650328f11695dfb754ca0f540516f188d27",
"aws_curl_args": "--timeout 1",
"codecov_curl_args": "--timeout 2",
"env_vars": "OS,PYTHON",
"fail_ci_if_error": "true",
"file": "coverage.xml",
"files": "dir1/coverage.xml,dir2/coverage.xml",
"flags": "test",
"functionalities" : "gcov,coveragepy,fix,search,code,network,gcovout,html,recursesubs",
"gcov_args": "--timeout 3",
"gcov_root_dr": "gcov_dir/",
"gcov_path_exclude": "**/exclude-dir/*.*",
"gcov_executable": "gcov",
"gcov_path_include": "**/include-dir/*.*",
"gcov_prefix": "demo",
"name": "codecov",
"override_branch": "thomasrockhu/test",
"override_build": "1",
"override_commit": "9caabca5474b49de74ef5667deabaf74cdacc244",
"override_pr": "2",
"override_tag": "v1.2",
"root_dir": "root/",
"directory": "coverage/",
"token": "d3859757-ab80-4664-924d-aef22fa7557b",
"verbose": "t",
"working-directory": "src/",
"path_to_write_report": "codecov/",
"xcode_derived_data": "~/Library/Developer/Xcode/DerivedData",
"xcode_package": "MyApp"
}

for (let env of Object.keys(envs)) {
process.env[env] = envs[env];
}

let { execArgs, options, filepath, fail_ci } = buildExec();
expect(execArgs).toEqual([
"codecov.sh",
"-n",
"",
"-F",
"",
"-Q",
"github-action"
]);
expect(filepath).toEqual('codecov.sh');
expect(fail_ci).toBeFalsy();

for (let env of Object.keys(envs)) {
delete process.env[env];
}
});

0 comments on commit 1794277

Please sign in to comment.