Skip to content

Commit 6bf3526

Browse files
test(html-to-react): refactor forEach to it.each
And add more test cases
1 parent 9cb48ed commit 6bf3526

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/html-to-react.test.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ describe('HTML to React', () => {
1818
});
1919

2020
describe('parser', () => {
21-
[undefined, null, {}, [], 42].forEach(value => {
22-
it(`throws an error if first argument is ${value}`, () => {
21+
it.each([undefined, null, {}, [], 0, 1, () => {}, new Date()])(
22+
'throws an error if first argument is %p',
23+
input => {
2324
expect(() => {
24-
parse(value);
25+
parse(input);
2526
}).toThrow(TypeError);
26-
});
27-
});
27+
}
28+
);
2829

2930
it('converts empty string to empty array', () => {
3031
expect(parse('')).toEqual([]);

0 commit comments

Comments
 (0)