Skip to content

Commit

Permalink
Test functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchell-codecov committed Jul 26, 2022
1 parent eb38f61 commit 37c776c
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions src/buildExec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,78 @@ test('all arguments', () => {
delete process.env['INPUT_' + env.toUpperCase()];
}
});

describe('trim arguments after splitting them', () => {
const baseExpectation = [
'-n',
expect.stringContaining(''),
'-Q',
expect.stringContaining('github-action'),
];

test('files', () => {
const envs = { 'files': './client-coverage.txt, ./lcov.info' };

for (const [name, value] of Object.entries(envs)) {
process.env['INPUT_' + name.toUpperCase()] = value;
}

const {execArgs} = buildExec();

expect(execArgs).toEqual([
...baseExpectation,
'-f',
'./client-coverage.txt',
'-f',
'./lcov.info',
]);

for (const env of Object.keys(envs)) {
delete process.env['INPUT_' + env.toUpperCase()];
}
});

test('flags', () => {
const envs = { 'flags': 'ios, mobile' };

for (const [name, value] of Object.entries(envs)) {
process.env['INPUT_' + name.toUpperCase()] = value;
}

const {execArgs} = buildExec();

expect(execArgs).toEqual([
...baseExpectation,
'-F',
'ios',
'-F',
'mobile',
]);

for (const env of Object.keys(envs)) {
delete process.env['INPUT_' + env.toUpperCase()];
}
});

test('functionalities', () => {
const envs = { 'functionalities': 'network, gcov' };

for (const [name, value] of Object.entries(envs)) {
process.env['INPUT_' + name.toUpperCase()] = value;
}

const {execArgs} = buildExec();

expect(execArgs).toEqual([
...baseExpectation,
'-X',
'network',
'-X',
'gcov',
]);

for (const env of Object.keys(envs)) {
delete process.env['INPUT_' + env.toUpperCase()];
}
});
});

0 comments on commit 37c776c

Please sign in to comment.