Skip to content

Commit c57fe4a

Browse files
adasqAdam Plocieniak
and
Adam Plocieniak
authored
ReactIs.isValidElementType Unit Test extended with PureComponent case (#20033)
Co-authored-by: Adam Plocieniak <adam.plocieniak@allegro.pl>
1 parent 02da938 commit c57fe4a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/react-is/src/__tests__/ReactIs-test.js

+8
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ describe('ReactIs', () => {
2929
expect(ReactIs.typeOf({})).toBe(undefined);
3030
expect(ReactIs.typeOf(null)).toBe(undefined);
3131
expect(ReactIs.typeOf(undefined)).toBe(undefined);
32+
expect(ReactIs.typeOf(NaN)).toBe(undefined);
33+
expect(ReactIs.typeOf(Symbol('def'))).toBe(undefined);
3234
});
3335

3436
it('identifies valid element types', () => {
@@ -37,6 +39,11 @@ describe('ReactIs', () => {
3739
return React.createElement('div');
3840
}
3941
}
42+
class PureComponent extends React.PureComponent {
43+
render() {
44+
return React.createElement('div');
45+
}
46+
}
4047

4148
const FunctionComponent = () => React.createElement('div');
4249
const ForwardRefComponent = React.forwardRef((props, ref) =>
@@ -48,6 +55,7 @@ describe('ReactIs', () => {
4855

4956
expect(ReactIs.isValidElementType('div')).toEqual(true);
5057
expect(ReactIs.isValidElementType(Component)).toEqual(true);
58+
expect(ReactIs.isValidElementType(PureComponent)).toEqual(true);
5159
expect(ReactIs.isValidElementType(FunctionComponent)).toEqual(true);
5260
expect(ReactIs.isValidElementType(ForwardRefComponent)).toEqual(true);
5361
expect(ReactIs.isValidElementType(LazyComponent)).toEqual(true);

0 commit comments

Comments
 (0)