From 6dd9fa46ca4a1294703d77f25855f03044421633 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Sun, 16 Jun 2024 12:15:49 -0700 Subject: [PATCH] RN: Migrate `LogBoxInspectorSourceMapStatus-test.js` from Shallow Renderer (#44986) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44986 Migrates this Jest unit test away from using `react-shallow-renderer` because it is no longer recommended. Changelog: [Internal] Reviewed By: robhogan Differential Revision: D58643069 fbshipit-source-id: a2dbba104a7f6af57b6990da3cb0055a5390bc00 --- .../LogBoxInspectorSourceMapStatus-test.js | 13 ++++-- ...ogBoxInspectorSourceMapStatus-test.js.snap | 42 +++++++------------ 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorSourceMapStatus-test.js b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorSourceMapStatus-test.js index 940efb2580f..f9ca446de36 100644 --- a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorSourceMapStatus-test.js +++ b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorSourceMapStatus-test.js @@ -16,9 +16,16 @@ const LogBoxInspectorSourceMapStatus = require('../LogBoxInspectorSourceMapStatus').default; const React = require('react'); +// Mock `LogBoxButton` because we are interested in snapshotting the behavior +// of `LogBoxInspectorSourceMapStatus`, not `LogBoxButton`. +jest.mock('../LogBoxButton', () => ({ + __esModule: true, + default: 'LogBoxButton', +})); + describe('LogBoxInspectorSourceMapStatus', () => { it('should render for failed', () => { - const output = render.shallowRender( + const output = render.create( {}} status="FAILED" />, ); @@ -26,7 +33,7 @@ describe('LogBoxInspectorSourceMapStatus', () => { }); it('should render for pending', () => { - const output = render.shallowRender( + const output = render.create( {}} status="PENDING" />, ); @@ -34,7 +41,7 @@ describe('LogBoxInspectorSourceMapStatus', () => { }); it('should render null for complete', () => { - const output = render.shallowRender( + const output = render.create( {}} status="COMPLETE" />, ); diff --git a/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorSourceMapStatus-test.js.snap b/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorSourceMapStatus-test.js.snap index 612a75000e4..df2fcc92128 100644 --- a/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorSourceMapStatus-test.js.snap +++ b/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorSourceMapStatus-test.js.snap @@ -27,25 +27,20 @@ exports[`LogBoxInspectorSourceMapStatus should render for failed 1`] = ` } } > - -