@@ -4,11 +4,13 @@ import android.app.Application
44import android.content.Context
55import com.revenuecat.purchases.DangerousSettings
66import com.revenuecat.purchases.EntitlementVerificationMode
7+ import com.revenuecat.purchases.ExperimentalPreviewRevenueCatPurchasesAPI
78import com.revenuecat.purchases.Purchases
89import com.revenuecat.purchases.PurchasesAreCompletedBy
910import com.revenuecat.purchases.PurchasesConfiguration
1011import com.revenuecat.purchases.Store
1112import com.revenuecat.purchases.common.PlatformInfo
13+ import com.revenuecat.purchases.galaxy.GalaxyBillingMode
1214import io.mockk.CapturingSlot
1315import io.mockk.every
1416import io.mockk.mockk
@@ -19,6 +21,7 @@ import org.junit.jupiter.api.Test
1921import kotlin.test.assertEquals
2022import kotlin.test.assertTrue
2123
24+ @OptIn(ExperimentalPreviewRevenueCatPurchasesAPI ::class )
2225internal class ConfiguringUnitTests {
2326 private val mockPurchases = mockk<Purchases >()
2427 private val mockContext = mockk<Context >(relaxed = true )
@@ -226,6 +229,60 @@ internal class ConfiguringUnitTests {
226229 assertEquals(expectedLocale, purchasesConfigurationSlot.captured.preferredUILocaleOverride)
227230 }
228231
232+ @Test
233+ fun `calling configure with Galaxy store configures the Android SDK with Galaxy store` () {
234+ configure(
235+ context = mockContext,
236+ apiKey = " api_key" ,
237+ appUserID = " appUserID" ,
238+ purchasesAreCompletedBy = PurchasesAreCompletedBy .REVENUECAT .name,
239+ platformInfo = expectedPlatformInfo,
240+ store = Store .GALAXY ,
241+ )
242+ assertEquals(Store .GALAXY , purchasesConfigurationSlot.captured.store)
243+ }
244+
245+ @Test
246+ fun `calling configure with Galaxy store defaults Galaxy billing mode to production` () {
247+ configure(
248+ context = mockContext,
249+ apiKey = " api_key" ,
250+ appUserID = " appUserID" ,
251+ purchasesAreCompletedBy = PurchasesAreCompletedBy .REVENUECAT .name,
252+ platformInfo = expectedPlatformInfo,
253+ store = Store .GALAXY ,
254+ )
255+ assertEquals(GalaxyBillingMode .PRODUCTION , purchasesConfigurationSlot.captured.galaxyBillingMode)
256+ }
257+
258+ @Test
259+ fun `calling configure with Galaxy billing mode test forwards it to Android SDK` () {
260+ configure(
261+ context = mockContext,
262+ apiKey = " api_key" ,
263+ appUserID = " appUserID" ,
264+ purchasesAreCompletedBy = PurchasesAreCompletedBy .REVENUECAT .name,
265+ platformInfo = expectedPlatformInfo,
266+ store = Store .GALAXY ,
267+ galaxyBillingMode = " TEST" ,
268+ )
269+ assertEquals(GalaxyBillingMode .TEST , purchasesConfigurationSlot.captured.galaxyBillingMode)
270+ }
271+
272+ @Test
273+ fun `calling configure with Galaxy billing mode always fail forwards it to Android SDK` () {
274+ configure(
275+ context = mockContext,
276+ apiKey = " api_key" ,
277+ appUserID = " appUserID" ,
278+ purchasesAreCompletedBy = PurchasesAreCompletedBy .REVENUECAT .name,
279+ platformInfo = expectedPlatformInfo,
280+ store = Store .GALAXY ,
281+ galaxyBillingMode = " ALWAYS_FAIL" ,
282+ )
283+ assertEquals(GalaxyBillingMode .ALWAYS_FAIL , purchasesConfigurationSlot.captured.galaxyBillingMode)
284+ }
285+
229286 private fun assertConfiguration (
230287 purchasesConfigurationSlot : CapturingSlot <PurchasesConfiguration >,
231288 expectedContext : Context ,
0 commit comments