Skip to content

Commit f764a63

Browse files
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
1 parent 16fdf69 commit f764a63

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerTest.kt‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ import com.facebook.react.uimanager.ThemedReactContext
2020
import com.facebook.react.uimanager.ViewManager
2121
import com.facebook.react.uimanager.ViewManagerRegistry
2222
import com.facebook.react.views.view.ReactViewManager
23+
import com.facebook.testutils.shadows.ShadowSoLoader
2324
import org.assertj.core.api.Assertions.assertThat
2425
import org.junit.Before
2526
import org.junit.Test
2627
import org.junit.runner.RunWith
2728
import org.robolectric.RobolectricTestRunner
29+
import org.robolectric.RuntimeEnvironment
30+
import org.robolectric.annotation.Config
2831

2932
/**
3033
* Tests for [SurfaceMountingManager] view lifecycle around preallocateView, deleteView, and
@@ -42,6 +45,7 @@ import org.robolectric.RobolectricTestRunner
4245
* See T223288217.
4346
*/
4447
@RunWith(RobolectricTestRunner::class)
48+
@Config(shadows = [ShadowSoLoader::class])
4549
class SurfaceMountingManagerTest {
4650
private lateinit var mountingManager: MountingManager
4751
private lateinit var themedReactContext: ThemedReactContext
@@ -50,7 +54,8 @@ class SurfaceMountingManagerTest {
5054
@Before
5155
fun setUp() {
5256
ReactNativeFeatureFlagsForTests.setUp()
53-
val reactContext = ReactTestHelper.createCatalystContextForTest()
57+
val reactContext =
58+
ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication())
5459
themedReactContext = ThemedReactContext(reactContext, reactContext, null, -1)
5560
mountingManager =
5661
MountingManager(

0 commit comments

Comments
 (0)