Advertisement
Guest User

Untitled

a guest
May 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. describe('addNumbers method ', () => {
  2. it('Should contain atleast one input ', () => {
  3. expect(addNumber(1,2)).toBe(3);
  4. expect(addNumber(1)).toBe(1);
  5. });
  6. it('Should throw an error is user doesnt input value ', () => {
  7. expect(addNumber()).Throw();
  8. })
  9. it('Should return the sum of numbers in the arguments ', () => {
  10. expect(addNumber(1,3)).toBe(4);
  11. expect(addNumber(2,3,5)).toBe(10);
  12. expect(addNumber(2,3,2,2,2,2)).toBe(13);
  13. })
  14. it('Should add the numbers in the arguments ', () => {
  15. expect(addNumber(1,3)).toBe(4);
  16. expect(addNumber(2,3,5)).toBe(10);
  17. expect(addNumber(2,3,2,2,2,2)).toBe(13);
  18. })
  19. it('Should check that the user inputs are numbers ', () => {
  20. expect(addNumber(true, false)).toBe('Input must be a number');
  21. expect(addNumber(' ', '1')).toBe('Input must be a number');
  22. expect(addNumber(2, '3')).toBe('Input must be a number');
  23. expect(addNumber('10', '2')).toBe('Input must be a number');
  24. })
  25. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement