Skip to content

Commit 2f3cc69

Browse files
committed
Update unit tests to account for language properties in createUser
1 parent 6fab6bb commit 2f3cc69

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

OneSignalSDK/onesignal/core/src/test/java/com/onesignal/user/internal/backend/UserBackendServiceTests.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ class UserBackendServiceTests : FunSpec({
4545
/* Given */
4646
val osId = "11111111-1111-1111-1111-111111111111"
4747
val spyHttpClient = mockk<IHttpClient>()
48-
coEvery { spyHttpClient.post(any(), any()) } returns HttpResponse(202, "{identity:{onesignal_id: \"$osId\", aliasLabel1: \"aliasValue1\"}, properties:{timezone_id: \"testTimeZone\"}}")
48+
coEvery { spyHttpClient.post(any(), any()) } returns HttpResponse(202, "{identity:{onesignal_id: \"$osId\", aliasLabel1: \"aliasValue1\"}, properties:{timezone_id: \"testTimeZone\", language: \"testLanguage\"}}")
4949
val userBackendService = UserBackendService(spyHttpClient)
5050
val identities = mapOf("aliasLabel1" to "aliasValue1")
51-
val properties = mapOf("timzone_id" to "testTimeZone")
51+
val properties = mapOf("timezone_id" to "testTimeZone", "language" to "testLanguage")
5252
val subscriptions = listOf<SubscriptionObject>()
5353

5454
/* When */
@@ -58,6 +58,7 @@ class UserBackendServiceTests : FunSpec({
5858
response.identities["onesignal_id"] shouldBe osId
5959
response.identities["aliasLabel1"] shouldBe "aliasValue1"
6060
response.properties.timezoneId shouldBe "testTimeZone"
61+
response.properties.language shouldBe "testLanguage"
6162
response.subscriptions.count() shouldBe 0
6263
coVerify {
6364
spyHttpClient.post(
@@ -77,11 +78,11 @@ class UserBackendServiceTests : FunSpec({
7778
/* Given */
7879
val osId = "11111111-1111-1111-1111-111111111111"
7980
val spyHttpClient = mockk<IHttpClient>()
80-
coEvery { spyHttpClient.post(any(), any()) } returns HttpResponse(202, "{identity:{onesignal_id: \"$osId\"}, subscriptions:[{id:\"subscriptionId1\", type:\"AndroidPush\"}], properties:{timezone_id: \"testTimeZone\"}}")
81+
coEvery { spyHttpClient.post(any(), any()) } returns HttpResponse(202, "{identity:{onesignal_id: \"$osId\"}, subscriptions:[{id:\"subscriptionId1\", type:\"AndroidPush\"}], properties:{timezone_id: \"testTimeZone\", language: \"testLanguage\"}}")
8182
val userBackendService = UserBackendService(spyHttpClient)
8283
val identities = mapOf<String, String>()
8384
val subscriptions = mutableListOf<SubscriptionObject>()
84-
val properties = mapOf("timzone_id" to "testTimeZone")
85+
val properties = mapOf("timezone_id" to "testTimeZone", "language" to "testLanguage")
8586
subscriptions.add(SubscriptionObject("SHOULDNOTUSE", SubscriptionObjectType.ANDROID_PUSH))
8687

8788
/* When */
@@ -90,6 +91,7 @@ class UserBackendServiceTests : FunSpec({
9091
/* Then */
9192
response.identities["onesignal_id"] shouldBe osId
9293
response.properties.timezoneId shouldBe "testTimeZone"
94+
response.properties.language shouldBe "testLanguage"
9395
response.subscriptions.count() shouldBe 1
9496
response.subscriptions[0].id shouldBe "subscriptionId1"
9597
response.subscriptions[0].type shouldBe SubscriptionObjectType.ANDROID_PUSH

0 commit comments

Comments
 (0)