Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Remove unnecessary prop type check in test #43211

Merged
merged 4 commits into from
Aug 7, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
aarongarciah marked this conversation as resolved.
Show resolved Hide resolved
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