Skip to content

Instantly share code, notes, and snippets.

@joeskeen
Created September 16, 2019 16:34
Show Gist options
  • Save joeskeen/cf823a9eee56a7336197c4b858f16d03 to your computer and use it in GitHub Desktop.
Save joeskeen/cf823a9eee56a7336197c4b858f16d03 to your computer and use it in GitHub Desktop.
a sample specification for a function that determines whether a given value is an integer
describe('isInteger', () => {
describe('when provided an integer value', () => {
it('should classify 5 as an integer');
it('should classify -5 as an integer');
it('should classify 0 as an integer');
});
describe('when provided a numerical value that is not an integer', () => {
it('should classify 3.14 as not an integer');
it('should classify -3.14 as not an integer');
it('should classify NaN as not an integer');
});
describe('when provided a non-numerical value', () => {
it('should classify null as not an integer');
it('should classify undefined as not an integer');
it('should classify true as not an integer');
it('should classify false as not an integer');
it('should classify {} as not an integer');
it('should classify [] as not an integer');
it('should classify '' as not an integer');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment