Last active
May 10, 2019 12:20
-
-
Save charleslukes/20e14da0d5e438d28238ada3ca0ab1b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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).toThrow(); | |
}) | |
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'); | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment