Skip to content

Instantly share code, notes, and snippets.

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