Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ internal class OutagerIntegrationTest {
"test_monthly",
"google_monthly",
null,
apiType = 1,
)
private val annualProduct = QProduct("test_annual", "google_annual", null)
private val inappProduct = QProduct("test_inapp", "no_ads", null)
private val annualProduct = QProduct("test_annual", "google_annual", null, apiType = 0)
private val inappProduct = QProduct("test_inapp", "no_ads", null, apiType = 2)
private val expectedProducts = mapOf(
monthlyProduct.qonversionId to monthlyProduct,
annualProduct.qonversionId to annualProduct,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import com.qonversion.android.sdk.internal.repository.DefaultRepository
import com.qonversion.android.sdk.listeners.QonversionEligibilityCallback
import com.qonversion.android.sdk.listeners.QonversionLaunchCallback
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertTrue
import org.junit.Assert.fail
import org.junit.Test
Expand All @@ -52,9 +53,9 @@ internal class QonversionRepositoryIntegrationTest {

private val installDate = 1679652674L

private val monthlyProduct = QProduct("test_monthly", "google_monthly", null)
private val annualProduct = QProduct("test_annual", "google_annual", null)
private val inappProduct = QProduct("test_inapp", "no_ads", null)
private val monthlyProduct = QProduct("test_monthly", "google_monthly", null, apiType = 1)
private val annualProduct = QProduct("test_annual", "google_annual", null, apiType = 0)
private val inappProduct = QProduct("test_inapp", "no_ads", null, apiType = 2)
private val expectedProducts = mapOf(
monthlyProduct.qonversionId to monthlyProduct,
annualProduct.qonversionId to annualProduct,
Expand Down Expand Up @@ -291,40 +292,18 @@ internal class QonversionRepositoryIntegrationTest {
)
)

val expectedPermissions = mapOf(
"noAds" to QPermission(
"noAds",
"test_inapp",
QProductRenewState.NonRenewable,
Date(1740130240000),
null,
QEntitlementSource.PlayStore,
1,
0,
null,
null,
null,
null,
QEntitlementGrantType.Purchase,
null,
emptyList()
)
)

val uid = UID_PREFIX + "_restore"
val callback = object : QonversionLaunchCallback {
override fun onSuccess(launchResult: QLaunchResult) {
// then
assertEquals(launchResult.uid, uid)
assertTrue(launchResult.uid.isNotEmpty())
assertTrue(Maps.difference(expectedProducts, launchResult.products).areEqual())
assertTrue(Maps.difference(expectedPermissions, launchResult.permissions).areEqual())
// Permissions are not checked here because restore may switch
// to an existing user whose entitlements we don't control.
assertEquals(expectedOfferings, launchResult.offerings)
assertTrue(
Maps.difference(
emptyMap(),
launchResult.productPermissions!!
).areEqual()
)
// productPermissions are not checked here because restore
// may switch to a user with active entitlements.
assertNotNull(launchResult.productPermissions)
signal.countDown()
}

Expand Down
Loading