Skip to content

Instantly share code, notes, and snippets.

@mauteri
Last active July 19, 2021 19:20
Show Gist options
  • Save mauteri/9af0c512ea5c20da819ca18a42a0aa29 to your computer and use it in GitHub Desktop.
Save mauteri/9af0c512ea5c20da819ca18a42a0aa29 to your computer and use it in GitHub Desktop.
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