georgiev955

sum-of-numbers

Aug 20th, 2023
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. describe('Sum of numbers inside an array', () => {
  2.     it('If input is an array of strings', () => {
  3.         let actual = func(['1', '2', '3']);
  4.         let expected = 6;
  5.  
  6.         expect(actual).to.be.equal(expected);
  7.     });
  8.  
  9.     it('If input is an array of negative numbers', () => {
  10.         let actual = func([-1, -2, -3]);
  11.         let expected = -6;
  12.  
  13.         expect(actual).to.be.equal(expected);
  14.     });
  15.  
  16.     it('If input is an array of strings including something that cant be converted', () => {
  17.         assert.equal(Number.isNaN(func(['1', '2', '3', 'Tosho'])), true);
  18.     });
  19.  
  20.     it('If array length is 0', () => {
  21.         let actual = func([]);
  22.         let expected = 0;
  23.  
  24.         expect(actual).to.be.equal(expected);
  25.     });
  26.  
  27. })
Advertisement
Add Comment
Please, Sign In to add comment