Skip to content

Commit

Permalink
[test] Remove unnecessary prop type check in test (#43211)
Browse files Browse the repository at this point in the history
Signed-off-by: Aarón García Hervás <[email protected]>
Co-authored-by: Diego Andai <[email protected]>
  • Loading branch information
aarongarciah and DiegoAndai authored Aug 7, 2024
1 parent f8a6e3c commit 4d2a7e0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/mui-lab/src/Masonry/Masonry.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ describe('<Masonry />', () => {
});

it('should throw console error when children are empty', function test() {
// React 19 removed prop types support
if (!/jsdom/.test(window.navigator.userAgent) || reactMajor >= 19) {
this.skip();
}
Expand All @@ -112,9 +113,14 @@ describe('<Masonry />', () => {
if (/jsdom/.test(window.navigator.userAgent)) {
this.skip();
}
expect(() => render(<Masonry columns={3} spacing={1} />)).toErrorDev(
'Warning: Failed prop type: The prop `children` is marked as required in `ForwardRef(Masonry)`, but its value is `undefined`.',
);

// React 19 removed prop types support
if (reactMajor < 19) {
expect(() => render(<Masonry columns={3} spacing={1} />)).toErrorDev(
'Warning: Failed prop type: The prop `children` is marked as required in `ForwardRef(Masonry)`, but its value is `undefined`.',
);
}

expect(() => render(<Masonry columns={3} spacing={1} />)).not.to.throw(new TypeError());
});
});
Expand Down

0 comments on commit 4d2a7e0

Please sign in to comment.