Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('sum(arr) - sum array of numbers', () => {
- it('should return 3 for [1,2]', () => {
- expect(sum([1, 2])).to.be.equal(3);
- });
- it('should return 1 for [1]', () => {
- expect(sum([1])).to.be.equal(1);
- });
- it('should return 0 for empty array', () => {
- expect(sum([])).to.be.equal(0);
- });
- it('should return 3 for [1.5, 2.5, -1]', () => {
- expect(sum([1.5, 2.5, -1])).to.be.equal(3);
- });
- it('should return NaN for invalid data', () => {
- expect(sum('invalid data')).to.be.NaN;
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement