From 33341faff3fc000a167a1408a1835f500e64ab45 Mon Sep 17 00:00:00 2001 From: Toni Rico Date: Thu, 20 Jul 2023 11:08:50 +0200 Subject: [PATCH] Fix integration tests and run them only in defaults flavor --- .../purchases/purchasesExtensions.kt | 8 +++--- .../purchases/BasePurchasesIntegrationTest.kt | 0 .../purchases/PurchasesIntegrationTest.kt | 0 .../BaseOfflineEntitlementsIntegrationTest.kt | 0 ...EntitlementsFreshInstallIntegrationTest.kt | 0 ...InitialRequestsCompletedIntegrationTest.kt | 27 ++++++++++--------- ...lementsInformationalModeIntegrationTest.kt | 0 7 files changed, 18 insertions(+), 17 deletions(-) rename purchases/src/{androidTest => androidTestDefaults}/kotlin/com/revenuecat/purchases/BasePurchasesIntegrationTest.kt (100%) rename purchases/src/{androidTest => androidTestDefaults}/kotlin/com/revenuecat/purchases/PurchasesIntegrationTest.kt (100%) rename purchases/src/{androidTest => androidTestDefaults}/kotlin/com/revenuecat/purchases/offlineentitlements/BaseOfflineEntitlementsIntegrationTest.kt (100%) rename purchases/src/{androidTest => androidTestDefaults}/kotlin/com/revenuecat/purchases/offlineentitlements/OfflineEntitlementsFreshInstallIntegrationTest.kt (100%) rename purchases/src/{androidTest => androidTestDefaults}/kotlin/com/revenuecat/purchases/offlineentitlements/OfflineEntitlementsWithInitialRequestsCompletedIntegrationTest.kt (94%) rename purchases/src/{androidTest => androidTestDefaults}/kotlin/com/revenuecat/purchases/trustedentitlements/TrustedEntitlementsInformationalModeIntegrationTest.kt (100%) diff --git a/purchases/src/androidTest/kotlin/com/revenuecat/purchases/purchasesExtensions.kt b/purchases/src/androidTest/kotlin/com/revenuecat/purchases/purchasesExtensions.kt index f8fe299b2..a8c164da5 100644 --- a/purchases/src/androidTest/kotlin/com/revenuecat/purchases/purchasesExtensions.kt +++ b/purchases/src/androidTest/kotlin/com/revenuecat/purchases/purchasesExtensions.kt @@ -29,13 +29,13 @@ fun Purchases.Companion.resetSingleton() { } var Purchases.forceServerErrors: Boolean - get() = appConfig.forceServerErrors + get() = purchasesOrchestrator.appConfig.forceServerErrors set(value) { - appConfig.forceServerErrors = value + purchasesOrchestrator.appConfig.forceServerErrors = value } var Purchases.forceSigningErrors: Boolean - get() = appConfig.forceSigningErrors + get() = purchasesOrchestrator.appConfig.forceSigningErrors set(value) { - appConfig.forceSigningErrors = value + purchasesOrchestrator.appConfig.forceSigningErrors = value } diff --git a/purchases/src/androidTest/kotlin/com/revenuecat/purchases/BasePurchasesIntegrationTest.kt b/purchases/src/androidTestDefaults/kotlin/com/revenuecat/purchases/BasePurchasesIntegrationTest.kt similarity index 100% rename from purchases/src/androidTest/kotlin/com/revenuecat/purchases/BasePurchasesIntegrationTest.kt rename to purchases/src/androidTestDefaults/kotlin/com/revenuecat/purchases/BasePurchasesIntegrationTest.kt diff --git a/purchases/src/androidTest/kotlin/com/revenuecat/purchases/PurchasesIntegrationTest.kt b/purchases/src/androidTestDefaults/kotlin/com/revenuecat/purchases/PurchasesIntegrationTest.kt similarity index 100% rename from purchases/src/androidTest/kotlin/com/revenuecat/purchases/PurchasesIntegrationTest.kt rename to purchases/src/androidTestDefaults/kotlin/com/revenuecat/purchases/PurchasesIntegrationTest.kt diff --git a/purchases/src/androidTest/kotlin/com/revenuecat/purchases/offlineentitlements/BaseOfflineEntitlementsIntegrationTest.kt b/purchases/src/androidTestDefaults/kotlin/com/revenuecat/purchases/offlineentitlements/BaseOfflineEntitlementsIntegrationTest.kt similarity index 100% rename from purchases/src/androidTest/kotlin/com/revenuecat/purchases/offlineentitlements/BaseOfflineEntitlementsIntegrationTest.kt rename to purchases/src/androidTestDefaults/kotlin/com/revenuecat/purchases/offlineentitlements/BaseOfflineEntitlementsIntegrationTest.kt diff --git a/purchases/src/androidTest/kotlin/com/revenuecat/purchases/offlineentitlements/OfflineEntitlementsFreshInstallIntegrationTest.kt b/purchases/src/androidTestDefaults/kotlin/com/revenuecat/purchases/offlineentitlements/OfflineEntitlementsFreshInstallIntegrationTest.kt similarity index 100% rename from purchases/src/androidTest/kotlin/com/revenuecat/purchases/offlineentitlements/OfflineEntitlementsFreshInstallIntegrationTest.kt rename to purchases/src/androidTestDefaults/kotlin/com/revenuecat/purchases/offlineentitlements/OfflineEntitlementsFreshInstallIntegrationTest.kt diff --git a/purchases/src/androidTest/kotlin/com/revenuecat/purchases/offlineentitlements/OfflineEntitlementsWithInitialRequestsCompletedIntegrationTest.kt b/purchases/src/androidTestDefaults/kotlin/com/revenuecat/purchases/offlineentitlements/OfflineEntitlementsWithInitialRequestsCompletedIntegrationTest.kt similarity index 94% rename from purchases/src/androidTest/kotlin/com/revenuecat/purchases/offlineentitlements/OfflineEntitlementsWithInitialRequestsCompletedIntegrationTest.kt rename to purchases/src/androidTestDefaults/kotlin/com/revenuecat/purchases/offlineentitlements/OfflineEntitlementsWithInitialRequestsCompletedIntegrationTest.kt index db1a4e9cd..aff806bbc 100644 --- a/purchases/src/androidTest/kotlin/com/revenuecat/purchases/offlineentitlements/OfflineEntitlementsWithInitialRequestsCompletedIntegrationTest.kt +++ b/purchases/src/androidTestDefaults/kotlin/com/revenuecat/purchases/offlineentitlements/OfflineEntitlementsWithInitialRequestsCompletedIntegrationTest.kt @@ -51,20 +51,21 @@ abstract class BaseOfflineEntitlementsWithInitialRequestsCompletedIntegrationTes } private fun waitForInitialRequestsToEnd(completion: () -> Unit) { - Purchases.sharedInstance.offlineEntitlementsManager.updateProductEntitlementMappingCacheIfStale { - if (it != null) { - fail("Expected to get product entitlement mapping but got error: $it") - } else { - Purchases.sharedInstance.getCustomerInfoWith( - onError = { customerInfoError -> - fail("Expected to succeed getting customer info. Got $customerInfoError") - }, - onSuccess = { - completion() - }, - ) + Purchases.sharedInstance.purchasesOrchestrator.offlineEntitlementsManager + .updateProductEntitlementMappingCacheIfStale { + if (it != null) { + fail("Expected to get product entitlement mapping but got error: $it") + } else { + Purchases.sharedInstance.getCustomerInfoWith( + onError = { customerInfoError -> + fail("Expected to succeed getting customer info. Got $customerInfoError") + }, + onSuccess = { + completion() + }, + ) + } } - } } // endregion helpers diff --git a/purchases/src/androidTest/kotlin/com/revenuecat/purchases/trustedentitlements/TrustedEntitlementsInformationalModeIntegrationTest.kt b/purchases/src/androidTestDefaults/kotlin/com/revenuecat/purchases/trustedentitlements/TrustedEntitlementsInformationalModeIntegrationTest.kt similarity index 100% rename from purchases/src/androidTest/kotlin/com/revenuecat/purchases/trustedentitlements/TrustedEntitlementsInformationalModeIntegrationTest.kt rename to purchases/src/androidTestDefaults/kotlin/com/revenuecat/purchases/trustedentitlements/TrustedEntitlementsInformationalModeIntegrationTest.kt