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
This commit is contained in:
Tim Yung
2024-06-16 12:15:49 -07:00
committed by Facebook GitHub Bot
parent 8c0541cb12
commit 6dd9fa46ca
2 changed files with 26 additions and 29 deletions
@@ -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(
<LogBoxInspectorSourceMapStatus onPress={() => {}} status="FAILED" />,
);
@@ -26,7 +33,7 @@ describe('LogBoxInspectorSourceMapStatus', () => {
});
it('should render for pending', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxInspectorSourceMapStatus onPress={() => {}} status="PENDING" />,
);
@@ -34,7 +41,7 @@ describe('LogBoxInspectorSourceMapStatus', () => {
});
it('should render null for complete', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxInspectorSourceMapStatus onPress={() => {}} status="COMPLETE" />,
);
@@ -27,25 +27,20 @@ exports[`LogBoxInspectorSourceMapStatus should render for failed 1`] = `
}
}
>
<Animated(Image)
<Image
collapsable={false}
source={
Object {
"testUri": "../Libraries/LogBox/UI/LogBoxImages/alert-triangle.png",
}
}
style={
Array [
Object {
"height": 14,
"marginEnd": 4,
"tintColor": "rgba(255, 255, 255, 0.4)",
"width": 16,
},
Object {
"tintColor": "rgba(243, 83, 105, 1)",
},
null,
]
Object {
"height": 14,
"marginEnd": 4,
"tintColor": "rgba(243, 83, 105, 1)",
"width": 16,
}
}
/>
<Text
@@ -94,25 +89,20 @@ exports[`LogBoxInspectorSourceMapStatus should render for pending 1`] = `
}
}
>
<Animated(Image)
<Image
collapsable={false}
source={
Object {
"testUri": "../Libraries/LogBox/UI/LogBoxImages/loader.png",
}
}
style={
Array [
Object {
"height": 14,
"marginEnd": 4,
"tintColor": "rgba(255, 255, 255, 0.4)",
"width": 16,
},
Object {
"tintColor": "rgba(250, 186, 48, 1)",
},
null,
]
Object {
"height": 14,
"marginEnd": 4,
"tintColor": "rgba(250, 186, 48, 1)",
"width": 16,
}
}
/>
<Text