forked from TheOdinProject/javascript-exercises
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsumAll-solution.spec.js
More file actions
25 lines (24 loc) · 803 Bytes
/
sumAll-solution.spec.js
File metadata and controls
25 lines (24 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const sumAll = require('./sumAll-solution');
describe('sumAll', () => {
test('sums numbers within the range', () => {
expect(sumAll(2, 4)).toEqual(9);
});
test('works with large numbers', () => {
expect(sumAll(1, 4000)).toEqual(8002000);
});
test('works with larger number first', () => {
expect(sumAll(123, 1)).toEqual(7626);
});
test('returns ERROR with negative numbers', () => {
expect(sumAll(-10, 4)).toEqual('ERROR');
});
test('returns ERROR with non-integer parameters', () => {
expect(sumAll(2.5, 4)).toEqual('ERROR');
});
test('returns ERROR with non-number parameters', () => {
expect(sumAll(10, '90')).toEqual('ERROR');
});
test('returns ERROR with non-number parameters', () => {
expect(sumAll(10, [90, 1])).toEqual('ERROR');
});
});