From e7978ab76a49ceff4e6f74bc44792b52c4526edc Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:25:38 -0700 Subject: [PATCH 01/11] Bridgeless-context FabricUIManagerPullModelTest (#59271) Summary: Migrate `FabricUIManagerPullModelTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Changelog: [Internal] Differential Revision: D126574347 --- .../com/facebook/react/fabric/FabricUIManagerPullModelTest.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/FabricUIManagerPullModelTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/FabricUIManagerPullModelTest.kt index e0796289dfc3..ee4ae40079e6 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/FabricUIManagerPullModelTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/FabricUIManagerPullModelTest.kt @@ -39,6 +39,7 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.mock import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment import org.robolectric.Shadows.shadowOf import org.robolectric.annotation.Config import org.robolectric.shadow.api.Shadow @@ -76,7 +77,8 @@ class FabricUIManagerPullModelTest { fun setup() { ReactNativeFeatureFlagsForTests.setUp() overrideFeatureFlags() - reactContext = ReactTestHelper.createCatalystContextForTest() + reactContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) underTest = FabricUIManager( reactContext, From 10c94ba645ffa3e72c4bdc3f78e9e6bdee03bb80 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:25:38 -0700 Subject: [PATCH 02/11] Bridgeless-context MountingManagerAnimatedPropsTest (#59272) Summary: Migrate `MountingManagerAnimatedPropsTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Changelog: [Internal] Differential Revision: D126574351 --- .../facebook/react/fabric/MountingManagerAnimatedPropsTest.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/MountingManagerAnimatedPropsTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/MountingManagerAnimatedPropsTest.kt index f9f4f59e5795..4a3f6f936d3c 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/MountingManagerAnimatedPropsTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/MountingManagerAnimatedPropsTest.kt @@ -31,6 +31,7 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment import org.robolectric.annotation.Config @RunWith(RobolectricTestRunner::class) @@ -54,7 +55,8 @@ class MountingManagerAnimatedPropsTest { @Before fun setUp() { ReactNativeFeatureFlagsForTests.setUp() - val reactContext = ReactTestHelper.createCatalystContextForTest() + val reactContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) themedReactContext = ThemedReactContext(reactContext, reactContext, null, -1) mountingManager = MountingManager(ViewManagerRegistry(listOf>(ReactViewManager())), {}) From 655ba6a2efa0cd86312fbbfe28a7bca71b12df6e Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:25:38 -0700 Subject: [PATCH 03/11] Bridgeless-context SurfaceMountingManagerSynchronousMountPropsTest (#59273) Summary: Migrate `SurfaceMountingManagerSynchronousMountPropsTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Changelog: [Internal] Differential Revision: D126574353 --- .../fabric/SurfaceMountingManagerSynchronousMountPropsTest.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerSynchronousMountPropsTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerSynchronousMountPropsTest.kt index 884078cdc72c..1e7e51deb722 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerSynchronousMountPropsTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerSynchronousMountPropsTest.kt @@ -34,6 +34,7 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment import org.robolectric.annotation.Config /** @@ -65,7 +66,8 @@ class SurfaceMountingManagerSynchronousMountPropsTest { @Before fun setUp() { ReactNativeFeatureFlagsForTests.setUp() - val reactContext = ReactTestHelper.createCatalystContextForTest() + val reactContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) themedReactContext = ThemedReactContext(reactContext, reactContext, null, -1) mountingManager = MountingManager( From 71624a373fa4a00a589563f30a3ab35afb6669e3 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:25:38 -0700 Subject: [PATCH 04/11] Bridgeless-context SurfaceMountingManagerTest (#59274) Summary: Migrate `SurfaceMountingManagerTest` 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: D126574354 --- .../facebook/react/fabric/SurfaceMountingManagerTest.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerTest.kt index f7372288b68f..a1282668eb23 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerTest.kt @@ -20,11 +20,14 @@ import com.facebook.react.uimanager.ThemedReactContext import com.facebook.react.uimanager.ViewManager import com.facebook.react.uimanager.ViewManagerRegistry import com.facebook.react.views.view.ReactViewManager +import com.facebook.testutils.shadows.ShadowSoLoader import org.assertj.core.api.Assertions.assertThat import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment +import org.robolectric.annotation.Config /** * Tests for [SurfaceMountingManager] view lifecycle around preallocateView, deleteView, and @@ -42,6 +45,7 @@ import org.robolectric.RobolectricTestRunner * See T223288217. */ @RunWith(RobolectricTestRunner::class) +@Config(shadows = [ShadowSoLoader::class]) class SurfaceMountingManagerTest { private lateinit var mountingManager: MountingManager private lateinit var themedReactContext: ThemedReactContext @@ -50,7 +54,8 @@ class SurfaceMountingManagerTest { @Before fun setUp() { ReactNativeFeatureFlagsForTests.setUp() - val reactContext = ReactTestHelper.createCatalystContextForTest() + val reactContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) themedReactContext = ThemedReactContext(reactContext, reactContext, null, -1) mountingManager = MountingManager( From 8c8b20218e15dc2e5d264df29b3d69d37aa18852 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:25:38 -0700 Subject: [PATCH 05/11] 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 --- .../react/uimanager/BaseViewManagerDelegateTest.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java index 13ad5c6a95c3..329f88e2fee8 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java @@ -16,13 +16,17 @@ import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests; import com.facebook.react.views.view.ReactViewGroup; import com.facebook.react.views.view.ReactViewManager; +import com.facebook.testutils.shadows.ShadowSoLoader; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.annotation.Config; @RunWith(RobolectricTestRunner.class) +@Config(shadows = ShadowSoLoader.class) public class BaseViewManagerDelegateTest { private ReactViewManager viewManager; private ReactViewGroup view; @@ -34,7 +38,9 @@ public void setUp() { // (non-JNI) accessor so Robolectric doesn't try to load react_featureflagsjni. ReactNativeFeatureFlagsForTests.INSTANCE.setUp(); viewManager = mock(ReactViewManager.class); - ReactApplicationContext context = ReactTestHelper.createCatalystContextForTest(); + ReactApplicationContext context = + ReactTestHelper.INSTANCE.createTestReactApplicationContext( + RuntimeEnvironment.getApplication()); ThemedReactContext themedReactContext = new ThemedReactContext(context, context, null, -1); view = new ReactViewGroup(themedReactContext); delegate = new BaseViewManagerDelegate<>(viewManager) {}; From 70654c0c8d4c34fff4db7d73b59d2f018a8b0d26 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:25:38 -0700 Subject: [PATCH 06/11] Bridgeless-context ImageLoaderModuleTest (#59278) Summary: Migrate `ImageLoaderModuleTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Stub the feature flags before context creation, since the bridgeless context reads them during init. Changelog: [Internal] Differential Revision: D126574356 --- .../facebook/react/modules/image/ImageLoaderModuleTest.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/image/ImageLoaderModuleTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/image/ImageLoaderModuleTest.kt index 45f1f7f59b69..f12159fe9e57 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/image/ImageLoaderModuleTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/image/ImageLoaderModuleTest.kt @@ -25,6 +25,7 @@ import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.ReactTestHelper import com.facebook.react.bridge.ReadableMap import com.facebook.react.bridge.WritableMap +import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests import com.facebook.react.views.image.ReactCallerContextFactory import com.facebook.react.views.imagehelper.ResourceDrawableIdHelper import com.facebook.testutils.shadows.ShadowArguments @@ -45,6 +46,7 @@ import org.mockito.kotlin.never import org.mockito.kotlin.verify import org.mockito.kotlin.whenever import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment import org.robolectric.annotation.Config /** The payload is never decoded — every test here mocks the image pipeline. */ @@ -60,7 +62,9 @@ class ImageLoaderModuleTest { @Before fun setUp() { - reactContext = ReactTestHelper.createCatalystContextForTest() + ReactNativeFeatureFlagsForTests.setUp() + reactContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) imageLoaderModule = ImageLoaderModule(reactContext) mockedHelper = mockStatic(ResourceDrawableIdHelper::class.java) From 744dc554f4d67eec789b4f6103e3700b27bf3d69 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:25:38 -0700 Subject: [PATCH 07/11] Bridgeless-context ShareModuleTest (#59279) Summary: Migrate `ShareModuleTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Add the `ShadowSoLoader` Robolectric shadow and stub the feature flags before context creation, since the bridgeless context reads them during init. Changelog: [Internal] Differential Revision: D126574357 --- .../com/facebook/react/modules/share/ShareModuleTest.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/share/ShareModuleTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/share/ShareModuleTest.kt index 95db0bd69577..72f7292aac17 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/share/ShareModuleTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/share/ShareModuleTest.kt @@ -13,7 +13,9 @@ import com.facebook.react.bridge.JavaOnlyMap import com.facebook.react.bridge.Promise import com.facebook.react.bridge.ReactTestHelper import com.facebook.react.bridge.WritableMap +import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests import com.facebook.testutils.shadows.ShadowArguments +import com.facebook.testutils.shadows.ShadowSoLoader import org.assertj.core.api.Assertions.assertThat import org.junit.Before import org.junit.Test @@ -25,7 +27,7 @@ import org.robolectric.Shadows.shadowOf import org.robolectric.android.controller.ActivityController import org.robolectric.annotation.Config -@Config(shadows = [ShadowArguments::class]) +@Config(shadows = [ShadowArguments::class, ShadowSoLoader::class]) @RunWith(RobolectricTestRunner::class) class ShareModuleTest { @@ -34,9 +36,11 @@ class ShareModuleTest { @Before fun prepareModules() { + ReactNativeFeatureFlagsForTests.setUp() activityController = Robolectric.buildActivity(FragmentActivity::class.java) val activity = activityController.create().start().resume().get() - val applicationContext = ReactTestHelper.createCatalystContextForTest() + val applicationContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) applicationContext.onNewIntent(activity, Intent()) shareModule = ShareModule(applicationContext) } From 31fd1b125356da0af4771dc831599b16422ba96c Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:25:38 -0700 Subject: [PATCH 08/11] Bridgeless-context ReactScrollViewHelperFlingAnimatorTest (#59277) Summary: Migrate `ReactScrollViewHelperFlingAnimatorTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Stub the feature flags before context creation, since the bridgeless context reads them during init. Changelog: [Internal] Differential Revision: D126574358 --- .../views/scroll/ReactScrollViewHelperFlingAnimatorTest.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/scroll/ReactScrollViewHelperFlingAnimatorTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/scroll/ReactScrollViewHelperFlingAnimatorTest.kt index f8fe3b37b616..f02176b93a03 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/scroll/ReactScrollViewHelperFlingAnimatorTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/scroll/ReactScrollViewHelperFlingAnimatorTest.kt @@ -13,6 +13,7 @@ import android.view.View import android.view.ViewGroup import com.facebook.react.bridge.ReactContext import com.facebook.react.bridge.ReactTestHelper +import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests import com.facebook.react.uimanager.StateWrapper import com.facebook.react.uimanager.UIManagerHelper import com.facebook.react.uimanager.events.Event @@ -63,10 +64,12 @@ class ReactScrollViewHelperFlingAnimatorTest { @Before @Suppress("UNCHECKED_CAST") fun setUp() { + ReactNativeFeatureFlagsForTests.setUp() mockChild = mock() mockAnimator = ValueAnimator() mockEventDispatcher = mock() - mockContext = ReactTestHelper.createCatalystContextForTest() + mockContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) mockScrollView = mock() From 8e7b777240e4d5dd8d05c9283f5fb36e5cf71f79 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:25:38 -0700 Subject: [PATCH 09/11] Bridgeless-context SurfaceMountingManagerEventOrderingTest Summary: Migrate `SurfaceMountingManagerEventOrderingTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Changelog: [Internal] Differential Revision: D126574360 --- .../react/fabric/SurfaceMountingManagerEventOrderingTest.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerEventOrderingTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerEventOrderingTest.kt index af0e1893d3f9..f38ef84da6cf 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerEventOrderingTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerEventOrderingTest.kt @@ -34,6 +34,7 @@ import org.mockito.kotlin.any import org.mockito.kotlin.mock import org.mockito.kotlin.never import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode @@ -59,7 +60,8 @@ class SurfaceMountingManagerEventOrderingTest { @Before fun setUp() { ReactNativeFeatureFlagsForTests.setUp() - val reactContext = ReactTestHelper.createCatalystContextForTest() + val reactContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) themedReactContext = ThemedReactContext(reactContext, reactContext, null, -1) mountingManager = MountingManager( From 39c8966ff99fbffa19fe6e686066240abfcbb5ec Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:25:38 -0700 Subject: [PATCH 10/11] Bridgeless-context ThemedReactContextTest (#59276) Summary: Migrate `ThemedReactContextTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Stub the feature flags before context creation, since the bridgeless context reads them during init. Changelog: [Internal] Differential Revision: D126574361 --- .../com/facebook/react/uimanager/ThemedReactContextTest.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ThemedReactContextTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ThemedReactContextTest.kt index b0e05900d1ba..45661c6d0f76 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ThemedReactContextTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ThemedReactContextTest.kt @@ -11,6 +11,7 @@ import android.view.Window import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.ReactTestHelper import com.facebook.react.interfaces.ExtraWindowEventListener +import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests import com.facebook.testutils.shadows.ShadowSoLoader import org.junit.Before import org.junit.Test @@ -31,7 +32,9 @@ class ThemedReactContextTest { @Before fun setUp() { - reactApplicationContext = ReactTestHelper.createCatalystContextForTest() + ReactNativeFeatureFlagsForTests.setUp() + reactApplicationContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) themedReactContext = ThemedReactContext(reactApplicationContext, RuntimeEnvironment.getApplication(), null, -1) window = mock() From 6ed502e9c0cca1a1eee13cfdecebac3e49366ff3 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 17:25:38 -0700 Subject: [PATCH 11/11] Bridgeless-context BlobModuleTest (#59281) Summary: Migrate `BlobModuleTest` from the deprecated `createCatalystContextForTest` helper to `createTestReactApplicationContext`, so the test builds a bridgeless context directly. Add the `ShadowSoLoader` Robolectric shadow and stub the feature flags before context creation, since the bridgeless context reads them during init. Changelog: [Internal] Differential Revision: D126574362 --- .../com/facebook/react/modules/blob/BlobModuleTest.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/blob/BlobModuleTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/blob/BlobModuleTest.kt index b64f1595c5be..ba826cb7aa63 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/blob/BlobModuleTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/blob/BlobModuleTest.kt @@ -12,8 +12,10 @@ import com.facebook.react.bridge.JavaOnlyArray import com.facebook.react.bridge.JavaOnlyMap import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.ReactTestHelper +import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests import com.facebook.soloader.SoLoader import com.facebook.testutils.shadows.ShadowArguments +import com.facebook.testutils.shadows.ShadowSoLoader import java.io.ByteArrayInputStream import java.nio.ByteBuffer import java.util.UUID @@ -26,11 +28,12 @@ import org.junit.runner.RunWith import org.mockito.MockedStatic import org.mockito.Mockito.mockStatic import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment import org.robolectric.Shadows.shadowOf import org.robolectric.annotation.Config @RunWith(RobolectricTestRunner::class) -@Config(manifest = Config.NONE, shadows = [ShadowArguments::class]) +@Config(manifest = Config.NONE, shadows = [ShadowArguments::class, ShadowSoLoader::class]) class BlobModuleTest { private lateinit var bytes: ByteArray private lateinit var blobId: String @@ -40,6 +43,7 @@ class BlobModuleTest { @Before fun prepareModules() { + ReactNativeFeatureFlagsForTests.setUp() mockedStaticSoLoader = mockStatic(SoLoader::class.java) mockedStaticSoLoader .`when` { SoLoader.loadLibrary("reactnativeblob") } @@ -48,7 +52,7 @@ class BlobModuleTest { bytes = ByteArray(120) Random.Default.nextBytes(bytes) - context = ReactTestHelper.createCatalystContextForTest() + context = ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) blobModule = BlobModule(context) blobId = blobModule.store(bytes) }