Skip to content

Instantly share code, notes, and snippets.

@salcode
Created December 23, 2022 19:37
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 salcode/3d3e7d02fc9a942ab25aa2d0eba5f889 to your computer and use it in GitHub Desktop.
Save salcode/3d3e7d02fc9a942ab25aa2d0eba5f889 to your computer and use it in GitHub Desktop.
Example Jest Test
import titleCase from '.';
const data = [
{
value: 'lord of the flies',
expected: 'Lord of the Flies',
},
{
value: 'once upon a time',
expected: 'Once Upon a Time',
},
];
describe.each(data)('titleCase', ({
value,
expected
}) => {
it(`should convert "${value}" to "${expected}"`, () => {
expect(
titleCase(value),
).toBe(expected);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment