From 00253a2efea33245cfa73649eb1b3e5906817877 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Sun, 16 Jun 2024 10:30:39 -0700 Subject: [PATCH] RN: Migrate `LogBoxInspectorContainer-test.js` from Shallow Renderer (#44985) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44985 Migrates this Jest unit test away from using `react-shallow-renderer` because it is no longer recommended. Changelog: [Internal] Reviewed By: robhogan Differential Revision: D58641095 fbshipit-source-id: 90563955876a148a2b867e0ec5128bdd8786f274 --- .../LogBoxInspectorContainer-test.js | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/react-native/Libraries/LogBox/__tests__/LogBoxInspectorContainer-test.js b/packages/react-native/Libraries/LogBox/__tests__/LogBoxInspectorContainer-test.js index 853954e6ebd..8368411158f 100644 --- a/packages/react-native/Libraries/LogBox/__tests__/LogBoxInspectorContainer-test.js +++ b/packages/react-native/Libraries/LogBox/__tests__/LogBoxInspectorContainer-test.js @@ -18,9 +18,16 @@ const { } = require('../LogBoxNotificationContainer'); const React = require('react'); +// Mock `LogBoxLogNotification` because we are interested in snapshotting the +// behavior of `LogBoxNotificationContainer`, not `LogBoxLogNotification`. +jest.mock('../UI/LogBoxNotification', () => ({ + __esModule: true, + default: 'LogBoxLogNotification', +})); + describe('LogBoxNotificationContainer', () => { it('should render null with no logs', () => { - const output = render.shallowRender( + const output = render.create( , ); @@ -28,7 +35,7 @@ describe('LogBoxNotificationContainer', () => { }); it('should render null with no selected log and disabled', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should render the latest warning notification', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should render the latest error notification', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should render both an error and warning notification', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should render selected fatal error even when disabled', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should render selected syntax error even when disabled', () => { - const output = render.shallowRender( + const output = render.create(