From f294bd82233826bc2388c14caec5cbae3dba15b6 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Sun, 16 Jun 2024 12:15:49 -0700 Subject: [PATCH] RN: Migrate `LogBoxNotificationContainer-test.js` from Shallow Renderer (#44981) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44981 Migrates this Jest unit test away from using `react-shallow-renderer` because it is no longer recommended. Changelog: [Internal] Reviewed By: robhogan Differential Revision: D58643062 fbshipit-source-id: 6d7bba78945509bbb6bdab1e6347ba0d90343ec3 --- .../LogBox/__tests__/LogBoxNotificationContainer-test.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/LogBox/__tests__/LogBoxNotificationContainer-test.js b/packages/react-native/Libraries/LogBox/__tests__/LogBoxNotificationContainer-test.js index 65ea3dab0db..11b71404a2d 100644 --- a/packages/react-native/Libraries/LogBox/__tests__/LogBoxNotificationContainer-test.js +++ b/packages/react-native/Libraries/LogBox/__tests__/LogBoxNotificationContainer-test.js @@ -18,9 +18,16 @@ const { } = require('../LogBoxInspectorContainer'); const React = require('react'); +// Mock `LogBoxInspector` because we are interested in snapshotting the behavior +// of `LogBoxNotificationContainer`, not `LogBoxInspector`. +jest.mock('../UI/LogBoxInspector', () => ({ + __esModule: true, + default: 'LogBoxInspector', +})); + describe('LogBoxNotificationContainer', () => { it('should render inspector with logs, even when disabled', () => { - const output = render.shallowRender( + const output = render.create(