Passes test 4 from exercise 05
This commit is contained in:
parent
56cdd5935c
commit
77972b4282
|
@ -1,4 +1,7 @@
|
|||
const sumAll = function(a, b) {
|
||||
if (a < 0 || b < 0) {
|
||||
return "ERROR";
|
||||
}
|
||||
let c, sum = 0;
|
||||
for ((a > b) ? (i = b, c = a)
|
||||
: (i = a, c = b); i <= c; i++) {
|
||||
|
|
|
@ -10,7 +10,7 @@ describe('sumAll', () => {
|
|||
test('works with larger number first', () => {
|
||||
expect(sumAll(123, 1)).toEqual(7626);
|
||||
});
|
||||
test.skip('returns ERROR with negative numbers', () => {
|
||||
test('returns ERROR with negative numbers', () => {
|
||||
expect(sumAll(-10, 4)).toEqual('ERROR');
|
||||
});
|
||||
test.skip('returns ERROR with non-number parameters', () => {
|
||||
|
|
Loading…
Reference in New Issue