Skip to content

Commit 2c27249

Browse files
Bridgeless-context BaseViewManagerDelegateTest (#59275)
Summary: Migrate `BaseViewManagerDelegateTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Add the `ShadowSoLoader` Robolectric shadow, which the new helper needs to mock the component factory. Changelog: [Internal] Differential Revision: D126574355
1 parent 805b63a commit 2c27249

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@
1616
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests;
1717
import com.facebook.react.views.view.ReactViewGroup;
1818
import com.facebook.react.views.view.ReactViewManager;
19+
import com.facebook.testutils.shadows.ShadowSoLoader;
1920
import org.junit.After;
2021
import org.junit.Before;
2122
import org.junit.Test;
2223
import org.junit.runner.RunWith;
2324
import org.robolectric.RobolectricTestRunner;
25+
import org.robolectric.RuntimeEnvironment;
26+
import org.robolectric.annotation.Config;
2427

2528
@RunWith(RobolectricTestRunner.class)
29+
@Config(shadows = ShadowSoLoader.class)
2630
public class BaseViewManagerDelegateTest {
2731
private ReactViewManager viewManager;
2832
private ReactViewGroup view;
@@ -34,7 +38,9 @@ public void setUp() {
3438
// (non-JNI) accessor so Robolectric doesn't try to load react_featureflagsjni.
3539
ReactNativeFeatureFlagsForTests.INSTANCE.setUp();
3640
viewManager = mock(ReactViewManager.class);
37-
ReactApplicationContext context = ReactTestHelper.createCatalystContextForTest();
41+
ReactApplicationContext context =
42+
ReactTestHelper.INSTANCE.createTestReactApplicationContext(
43+
RuntimeEnvironment.getApplication());
3844
ThemedReactContext themedReactContext = new ThemedReactContext(context, context, null, -1);
3945
view = new ReactViewGroup(themedReactContext);
4046
delegate = new BaseViewManagerDelegate<>(viewManager) {};

0 commit comments

Comments
 (0)