From 4d2a7e03f48f48fddc861c6d7ae3a955174c9099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aar=C3=B3n=20Garc=C3=ADa=20Herv=C3=A1s?= Date: Wed, 7 Aug 2024 17:18:40 +0200 Subject: [PATCH] [test] Remove unnecessary prop type check in test (#43211) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Aarón García Hervás Co-authored-by: Diego Andai --- packages/mui-lab/src/Masonry/Masonry.test.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/mui-lab/src/Masonry/Masonry.test.js b/packages/mui-lab/src/Masonry/Masonry.test.js index 790ff5e3a16c19..d79510cbdd3d02 100644 --- a/packages/mui-lab/src/Masonry/Masonry.test.js +++ b/packages/mui-lab/src/Masonry/Masonry.test.js @@ -100,6 +100,7 @@ describe('', () => { }); 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(); } @@ -112,9 +113,14 @@ describe('', () => { if (/jsdom/.test(window.navigator.userAgent)) { this.skip(); } - expect(() => render()).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()).toErrorDev( + 'Warning: Failed prop type: The prop `children` is marked as required in `ForwardRef(Masonry)`, but its value is `undefined`.', + ); + } + expect(() => render()).not.to.throw(new TypeError()); }); });