Skip to content

Instantly share code, notes, and snippets.

@marcoemrich
Last active July 3, 2020 14:28
Show Gist options
  • Save marcoemrich/417d3889e60b6614d87ebcbddf9e299e to your computer and use it in GitHub Desktop.
Save marcoemrich/417d3889e60b6614d87ebcbddf9e299e to your computer and use it in GitHub Desktop.
JS-Testing: leap year specs
describe('leap year specs', () => {
describe('A year is a leap year if', () => {
it('is divisible by 4 but not by 100', () => {
expect(isLeapYear(2016)).toBeTruthy()
});
it('is divisible by 400', () => {
expect(isLeapYear(2000)).toBeTruthy()
});
});
describe('A year is *NOT* a leap year if', () => {
it('is not divisible by 4', () => {
expect(isLeapYear(3)).toBeFalsy();
});
it('is divisible by 100 but not by 400', () => {
expect(isLeapYear(100)).toBeFalsy();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment