Skip to content

Instantly share code, notes, and snippets.

@justinobney
Last active August 7, 2017 17:55
Show Gist options
  • Save justinobney/39729b5704dfd5c7d12322d6158f2c8a to your computer and use it in GitHub Desktop.
Save justinobney/39729b5704dfd5c7d12322d6158f2c8a to your computer and use it in GitHub Desktop.
const cases = (testName, ...testCases) => (test) => testCases.forEach(args=>it(testName, async () => test(...args)));
describe('Test Cases', () => {
const multiply = (x,y) => x*y;
cases(
'can multiply things...',
[1,2,2],
[2,2,4],
[3,3,9],
)((x,y,expected) => {
expect(multiply(x,y)).toEqual(expected);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment