Skip to content

Commit 6ddcaf9

Browse files
committed
fixed create user test to ensure we omit aliases
PR #1794 made changes to omit aliases on user create, but the test was never updated. Also the SubscriptionStatus arg part of this test wasn't compare the corret types, causing it to fail the test.
1 parent 109157e commit 6ddcaf9

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

OneSignalSDK/onesignal/core/src/test/java/com/onesignal/user/internal/operations/LoginUserOperationExecutorTests.kt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,18 @@ class LoginUserOperationExecutorTests : FunSpec({
392392
coVerify(exactly = 1) {
393393
mockUserBackendService.createUser(
394394
appId,
395-
mapOf("aliasLabel1" to "aliasValue1-2"),
395+
// Aliases omitted intentionally in PR #1794, to avoid failed create user calls.
396+
// - Ideally we batch as much as possible into the create as most of the time it
397+
// should be successful. Then when there are failures omit the "bad data" and try
398+
// again, however this is more complex which is why it wasn't done initially.
399+
mapOf(),
396400
withArg {
397401
it.count() shouldBe 1
398-
it[0].type shouldBe SubscriptionObjectType.ANDROID_PUSH
399-
it[0].enabled shouldBe true
400-
it[0].token shouldBe "pushToken2"
401-
it[0].notificationTypes shouldBe SubscriptionStatus.SUBSCRIBED
402+
val subscription = it[0]
403+
subscription.type shouldBe SubscriptionObjectType.ANDROID_PUSH
404+
subscription.enabled shouldBe true
405+
subscription.token shouldBe "pushToken2"
406+
SubscriptionStatus.fromInt(subscription.notificationTypes!!) shouldBe SubscriptionStatus.SUBSCRIBED
402407
},
403408
any(),
404409
)

0 commit comments

Comments
 (0)