Test functionality

This commit is contained in:
Mitchell Borrego 2022-07-26 01:11:46 -04:00
parent eb38f6167e
commit 37c776c131
No known key found for this signature in database
GPG key ID: BE864F77C8CFBB4C

View file

@ -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()];
}
});
});