Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('addNumbers method ', () => {
- it('Should contain atleast one input ', () => {
- expect(addNumber(1,2)).toBe(3);
- expect(addNumber(1)).toBe(1);
- });
- it('Should throw an error is user doesnt input value ', () => {
- expect(addNumber()).Throw();
- })
- it('Should return the sum of numbers in the arguments ', () => {
- expect(addNumber(1,3)).toBe(4);
- expect(addNumber(2,3,5)).toBe(10);
- expect(addNumber(2,3,2,2,2,2)).toBe(13);
- })
- it('Should add the numbers in the arguments ', () => {
- expect(addNumber(1,3)).toBe(4);
- expect(addNumber(2,3,5)).toBe(10);
- expect(addNumber(2,3,2,2,2,2)).toBe(13);
- })
- it('Should check that the user inputs are numbers ', () => {
- expect(addNumber(true, false)).toBe('Input must be a number');
- expect(addNumber(' ', '1')).toBe('Input must be a number');
- expect(addNumber(2, '3')).toBe('Input must be a number');
- expect(addNumber('10', '2')).toBe('Input must be a number');
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement