Skip to content

Instantly share code, notes, and snippets.

@Kamilnaja
Created August 10, 2023 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kamilnaja/f27fd8531efc996ce33b5dfb4a71619c to your computer and use it in GitHub Desktop.
Save Kamilnaja/f27fd8531efc996ce33b5dfb4a71619c to your computer and use it in GitHub Desktop.
import { it } from '@jest/globals';
import { divide } from './it.each';
describe('it.each', () => {
it.each([
[1, 2, '0.5'],
[12, 3, '4'],
[1, 4, '0.25'],
[4, 0, ''],
])(
'should add number %d to number %d to give result %s',
(a, b, expected) => {
expect(divide(a, b)).toBe(expected);
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment