format code
This commit is contained in:
parent
bc9591a12b
commit
bcb5b28954
4 changed files with 41 additions and 41 deletions
|
|
@ -15,23 +15,23 @@ test('getMemoryFlag() should return the correct --ram flag', t => {
|
|||
const totalMem = Math.floor(os.totalmem() / (1024 * 1024));
|
||||
|
||||
const tests = {
|
||||
"": `--ram=${totalMem - 256}`,
|
||||
"512": "--ram=512",
|
||||
"": `--ram=${totalMem - 256}`,
|
||||
"512": "--ram=512",
|
||||
};
|
||||
|
||||
for (const [input, expectedFlag] of Object.entries(tests)) {
|
||||
|
||||
process.env['INPUT_RAM'] = input;
|
||||
process.env['INPUT_RAM'] = input;
|
||||
|
||||
const flag = util.getMemoryFlag();
|
||||
t.deepEqual(flag, expectedFlag);
|
||||
const flag = util.getMemoryFlag();
|
||||
t.deepEqual(flag, expectedFlag);
|
||||
}
|
||||
});
|
||||
|
||||
test('getMemoryFlag() throws if the ram input is < 0 or NaN', t => {
|
||||
for (const input of ["-1", "hello!"]) {
|
||||
process.env['INPUT_RAM'] = input;
|
||||
t.throws(util.getMemoryFlag);
|
||||
process.env['INPUT_RAM'] = input;
|
||||
t.throws(util.getMemoryFlag);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -40,23 +40,23 @@ test('getThreadsFlag() should return the correct --threads flag', t => {
|
|||
const numCpus = os.cpus().length;
|
||||
|
||||
const tests = {
|
||||
"0": "--threads=0",
|
||||
"1": "--threads=1",
|
||||
[`${numCpus + 1}`]: `--threads=${numCpus}`
|
||||
"0": "--threads=0",
|
||||
"1": "--threads=1",
|
||||
[`${numCpus + 1}`]: `--threads=${numCpus}`
|
||||
};
|
||||
|
||||
for (const [input, expectedFlag] of Object.entries(tests)) {
|
||||
|
||||
process.env['INPUT_THREADS'] = input;
|
||||
process.env['INPUT_THREADS'] = input;
|
||||
|
||||
const flag = util.getThreadsFlag();
|
||||
t.deepEqual(flag, expectedFlag);
|
||||
const flag = util.getThreadsFlag();
|
||||
t.deepEqual(flag, expectedFlag);
|
||||
}
|
||||
});
|
||||
|
||||
test('getThreadsFlag() throws if the ram input is < 0 or NaN', t => {
|
||||
for (const input of ["-1", "hello!"]) {
|
||||
process.env['INPUT_THREADS'] = input;
|
||||
t.throws(util.getThreadsFlag);
|
||||
process.env['INPUT_THREADS'] = input;
|
||||
t.throws(util.getThreadsFlag);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue