Passed final tests for exercise 05

This commit is contained in:
NetMan 2024-01-05 21:56:46 +01:00
parent 77972b4282
commit c47a205e6f
2 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,5 @@
const sumAll = function(a, b) { const sumAll = function(a, b) {
if (a < 0 || b < 0) { if (a < 0 || b < 0 || typeof(a) != "number"|| typeof(b) != "number") {
return "ERROR"; return "ERROR";
} }
let c, sum = 0; let c, sum = 0;

View File

@ -13,10 +13,10 @@ describe('sumAll', () => {
test('returns ERROR with negative numbers', () => { test('returns ERROR with negative numbers', () => {
expect(sumAll(-10, 4)).toEqual('ERROR'); expect(sumAll(-10, 4)).toEqual('ERROR');
}); });
test.skip('returns ERROR with non-number parameters', () => { test('returns ERROR with non-number parameters', () => {
expect(sumAll(10, "90")).toEqual('ERROR'); expect(sumAll(10, "90")).toEqual('ERROR');
}); });
test.skip('returns ERROR with non-number parameters', () => { test('returns ERROR with non-number parameters', () => {
expect(sumAll(10, [90, 1])).toEqual('ERROR'); expect(sumAll(10, [90, 1])).toEqual('ERROR');
}); });
}); });