Skip to content

Commit

Permalink
feat(emarsys): setAuthenticatedContact will not disable predict
Browse files Browse the repository at this point in the history
SUITEDEV-35599

Co-authored-by: megamegax <[email protected]>
  • Loading branch information
LordAndras and megamegax committed May 2, 2024
1 parent 0600e41 commit 6a750ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 11 additions & 3 deletions emarsys-sdk/src/androidTest/java/com/emarsys/EmarsysTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ class EmarsysTest : AnnotationSpec() {
}

@Test
fun testSetAuthenticatedContactWithCompletionListener_doNotDelegatesToMobileEngageApi_whenMobileEngageDisabled() {
fun testSetAuthenticatedContactWithCompletionListener_doNotDelegatesToMobileEngageApi_whenMobileEngageDisabled_andPredictIsEnabled() {
setup(predictConfig)

setAuthenticatedContact(CONTACT_FIELD_ID, OPEN_ID_TOKEN, completionListener)
Expand All @@ -719,16 +719,24 @@ class EmarsysTest : AnnotationSpec() {
OPEN_ID_TOKEN,
completionListener
)
FeatureRegistry.isFeatureEnabled(InnerFeature.PREDICT) shouldBe false
FeatureRegistry.isFeatureEnabled(InnerFeature.PREDICT) shouldBe true
verifyNoInteractions(mockPredictRestricted)
}

@Test
fun testSetAuthenticatedContactWithCompletionListener_doNotDelegatesToMobileEngageApi_whenMobileEngageAndPredictDisabled() {
fun testSetAuthenticatedContactWithCompletionListener_delegatesToLoggingMobileEngageApi_whenMobileEngageAndPredictDisabled() {
setup(baseConfig)

setAuthenticatedContact(CONTACT_FIELD_ID, OPEN_ID_TOKEN, completionListener)

runBlockingOnCoreSdkThread()

verify(mockLoggingMobileEngageApi).setAuthenticatedContact(
CONTACT_FIELD_ID,
OPEN_ID_TOKEN,
completionListener
)

runBlockingOnCoreSdkThread {
verifyNoInteractions(mockPredictRestricted)
setAuthenticatedContact(CONTACT_FIELD_ID, OPEN_ID_TOKEN, completionListener)
Expand Down
2 changes: 0 additions & 2 deletions emarsys-sdk/src/main/java/com/emarsys/Emarsys.kt
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ object Emarsys {
.proxyApi(mobileEngage().concurrentHandlerHolder)
.setAuthenticatedContact(contactFieldId, openIdToken, completionListener)
}

FeatureRegistry.disableFeature(PREDICT)
}

@JvmStatic
Expand Down

0 comments on commit 6a750ce

Please sign in to comment.