From ceebab44b44674ecab485db1ec49e22bd4b53c84 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Wed, 3 May 2023 03:27:17 -0700 Subject: [PATCH] Update ReactActivityDelegateTest to compile and run with Buck (#37199) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37199 This test `ReactActivityDelegateTest` is written in Kotlin and is not currently picked up by BUCK. As we look into having more and more tests written in Kotlin, I'm updating one Kotlin test to be executed correctly within Buck. Changelog: [Internal] [Changed] - Update ReactActivityDelegateTest to compile and run with Buck Reviewed By: philIip, mdvacca Differential Revision: D45497636 fbshipit-source-id: 7e13902c4f765974c1ff490b657846fb062eb74e --- .../java/com/facebook/react/ReactActivityDelegateTest.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/ReactActivityDelegateTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/ReactActivityDelegateTest.kt index dcf9da8ed02..2912a9c1936 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/ReactActivityDelegateTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/ReactActivityDelegateTest.kt @@ -7,6 +7,7 @@ package com.facebook.react +import android.app.Activity import android.os.Bundle import org.junit.Assert.* import org.junit.Test @@ -16,10 +17,12 @@ import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) class ReactActivityDelegateTest { + val nullDelegate: Activity? = null + @Test fun delegateWithFabricEnabled_populatesInitialPropsCorrectly() { val delegate = - object : ReactActivityDelegate(null, "test-delegate") { + object : ReactActivityDelegate(nullDelegate, "test-delegate") { override fun isFabricEnabled() = true public val inspectLaunchOptions: Bundle? get() = composeLaunchOptions() @@ -33,7 +36,7 @@ class ReactActivityDelegateTest { @Test fun delegateWithoutFabricEnabled_hasNullInitialProperties() { val delegate = - object : ReactActivityDelegate(null, "test-delegate") { + object : ReactActivityDelegate(nullDelegate, "test-delegate") { override fun isFabricEnabled() = false public val inspectLaunchOptions: Bundle? get() = composeLaunchOptions() @@ -45,7 +48,7 @@ class ReactActivityDelegateTest { @Test fun delegateWithFabricEnabled_composesInitialPropertiesCorrectly() { val delegate = - object : ReactActivityDelegate(null, "test-delegate") { + object : ReactActivityDelegate(nullDelegate, "test-delegate") { override fun isFabricEnabled() = true override fun getLaunchOptions(): Bundle = Bundle().apply { putString("test-property", "test-value") }