diff --git a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrames-test.js b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrames-test.js index f7381ed1206..a8d648692c9 100644 --- a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrames-test.js +++ b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrames-test.js @@ -17,9 +17,15 @@ import LogBoxInspectorStackFrames, { const render = require('../../../../jest/renderer'); const LogBoxLog = require('../../Data/LogBoxLog').default; -const {} = require('../LogBoxInspectorStackFrames'); const React = require('react'); +// Mock `LogBoxInspectorSection` because we are interested in snapshotting the +// behavior of `LogBoxInspectorStackFrames`, not `LogBoxInspectorSection`. +jest.mock('../LogBoxInspectorSection', () => ({ + __esModule: true, + default: 'LogBoxInspectorSection', +})); + const createLogWithFrames = (collapsedOptions: Array) => { return new LogBoxLog({ level: 'warn', @@ -44,9 +50,9 @@ const createCollapsedFrames = (collapsedOptions: Array) => { })); }; -describe('LogBoxInspectorStackFrame', () => { +describe('LogBoxInspectorStackFrames', () => { it('should render stack frames with 1 frame collapsed', () => { - const output = render.shallowRender( + const output = render.create( {}} log={createLogWithFrames([false, true])} @@ -57,7 +63,7 @@ describe('LogBoxInspectorStackFrame', () => { }); it('should render null for empty stack frames', () => { - const output = render.shallowRender( + const output = render.create( {}} log={createLogWithFrames([])} diff --git a/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorStackFrames-test.js.snap b/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorStackFrames-test.js.snap index 8d2882cebb0..803ef114aeb 100644 --- a/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorStackFrames-test.js.snap +++ b/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorStackFrames-test.js.snap @@ -1,61 +1,190 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`LogBoxInspectorStackFrame should render null for empty stack frames 1`] = `null`; +exports[`LogBoxInspectorStackFrames should render null for empty stack frames 1`] = `null`; -exports[`LogBoxInspectorStackFrame should render stack frames with 1 frame collapsed 1`] = ` - +exports[`LogBoxInspectorStackFrames should render stack frames with 1 frame collapsed 1`] = ` + - This call stack is not symbolicated. Some features are unavailable such as viewing the function name or tapping to open files. + Call Stack - - - + > + + + This call stack is not symbolicated. Some features are unavailable such as viewing the function name or tapping to open files. + + + + + + foo + + + dependency.js:1:2 + + + + + + + See 1 more frame + + + + + `;