Last active
July 19, 2021 19:20
-
-
Save mauteri/9af0c512ea5c20da819ca18a42a0aa29 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
import { isPositiveNumber } from '../index'; | |
describe('isPositiveNumber', () => { | |
test('Returns true if number is positive', () => { | |
expect(isPositiveNumber(5)).toBe(true); | |
}); | |
test('Returns false if number is negative', () => { | |
expect(isPositiveNumber(-5)).toBe(false); | |
}); | |
test('Returns false if number is zero', () => { | |
expect(isPositiveNumber(0)).toBe(false); | |
}); | |
test('Throws when non-number passed', () => { | |
expect(() => { | |
isPositiveNumber('unittest'); | |
}).toThrow('Parameter was not a number.'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment