@@ -74,6 +74,7 @@ class OutcomeEventsControllerTests : FunSpec({
7474 MockHelper .configModelStore(),
7575 MockHelper .identityModelStore(),
7676 mockSubscriptionManager,
77+ MockHelper .deviceService(),
7778 MockHelper .time(now),
7879 )
7980
@@ -82,7 +83,7 @@ class OutcomeEventsControllerTests : FunSpec({
8283
8384 /* Then */
8485 evnt shouldBe null
85- coVerify(exactly = 0) { mockOutcomeEventsBackend.sendOutcomeEvent(any(), any(), any(), any(), any()) }
86+ coVerify(exactly = 0) { mockOutcomeEventsBackend.sendOutcomeEvent(any(), any(), any(), any(), any(), any() ) }
8687 }
8788
8889 test("send outcome with unattributed influences") {
@@ -112,6 +113,7 @@ class OutcomeEventsControllerTests : FunSpec({
112113 MockHelper .configModelStore(),
113114 MockHelper .identityModelStore { it.onesignalId = "onesignalId" },
114115 mockSubscriptionManager,
116+ MockHelper .deviceService(),
115117 MockHelper .time(now),
116118 )
117119
@@ -126,7 +128,7 @@ class OutcomeEventsControllerTests : FunSpec({
126128 evnt.session shouldBe InfluenceType .UNATTRIBUTED
127129 evnt.timestamp shouldBe 0 // timestamp only set when it had to be saved.
128130
129- coVerify(exactly = 1) { mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", null, evnt) }
131+ coVerify(exactly = 1) { mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", " AndroidPush ", null, evnt) }
130132 }
131133
132134 test("send outcome with indirect influences") {
@@ -157,6 +159,7 @@ class OutcomeEventsControllerTests : FunSpec({
157159 MockHelper .configModelStore(),
158160 MockHelper .identityModelStore { it.onesignalId = "onesignalId" },
159161 mockSubscriptionManager,
162+ MockHelper .deviceService(),
160163 MockHelper .time(now),
161164 )
162165
@@ -172,7 +175,7 @@ class OutcomeEventsControllerTests : FunSpec({
172175 evnt.session shouldBe InfluenceType .INDIRECT
173176 evnt.timestamp shouldBe 0 // timestamp only set when it had to be saved.
174177
175- coVerify(exactly = 1) { mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", false, evnt) }
178+ coVerify(exactly = 1) { mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", " AndroidPush ", false, evnt) }
176179 }
177180
178181 test("send outcome with direct influence") {
@@ -203,6 +206,7 @@ class OutcomeEventsControllerTests : FunSpec({
203206 MockHelper .configModelStore(),
204207 MockHelper .identityModelStore { it.onesignalId = "onesignalId" },
205208 mockSubscriptionManager,
209+ MockHelper .deviceService(),
206210 MockHelper .time(now),
207211 )
208212
@@ -218,7 +222,7 @@ class OutcomeEventsControllerTests : FunSpec({
218222 evnt.session shouldBe InfluenceType .DIRECT
219223 evnt.timestamp shouldBe 0 // timestamp only set when it had to be saved.
220224
221- coVerify(exactly = 1) { mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", true, evnt) }
225+ coVerify(exactly = 1) { mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", " AndroidPush ", true, evnt) }
222226 }
223227
224228 test("send outcome with weight") {
@@ -249,6 +253,7 @@ class OutcomeEventsControllerTests : FunSpec({
249253 MockHelper .configModelStore(),
250254 MockHelper .identityModelStore { it.onesignalId = "onesignalId" },
251255 mockSubscriptionManager,
256+ MockHelper .deviceService(),
252257 MockHelper .time(now),
253258 )
254259
@@ -263,7 +268,7 @@ class OutcomeEventsControllerTests : FunSpec({
263268 evnt.session shouldBe InfluenceType .UNATTRIBUTED
264269 evnt.timestamp shouldBe 0 // timestamp only set when it had to be saved.
265270
266- coVerify(exactly = 1) { mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", null, evnt) }
271+ coVerify(exactly = 1) { mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", " AndroidPush ", null, evnt) }
267272 }
268273
269274 test("send unique outcome with unattributed influences") {
@@ -293,6 +298,7 @@ class OutcomeEventsControllerTests : FunSpec({
293298 MockHelper .configModelStore(),
294299 MockHelper .identityModelStore { it.onesignalId = "onesignalId" },
295300 mockSubscriptionManager,
301+ MockHelper .deviceService(),
296302 MockHelper .time(now),
297303 )
298304
@@ -310,7 +316,7 @@ class OutcomeEventsControllerTests : FunSpec({
310316
311317 evnt2 shouldBe null
312318
313- coVerify(exactly = 1) { mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", any(), any()) }
319+ coVerify(exactly = 1) { mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", " AndroidPush ", any(), any()) }
314320 }
315321
316322 test("send unique outcome with same indirect influences") {
@@ -346,6 +352,7 @@ class OutcomeEventsControllerTests : FunSpec({
346352 MockHelper .configModelStore(),
347353 MockHelper .identityModelStore { it.onesignalId = "onesignalId" },
348354 mockSubscriptionManager,
355+ MockHelper .deviceService(),
349356 MockHelper .time(now),
350357 )
351358
@@ -366,7 +373,7 @@ class OutcomeEventsControllerTests : FunSpec({
366373
367374 evnt2 shouldBe null
368375
369- coVerify(exactly = 1) { mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", any(), any()) }
376+ coVerify(exactly = 1) { mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", " AndroidPush ", any(), any()) }
370377 }
371378
372379 test("send unique outcome with different indirect influences") {
@@ -404,6 +411,7 @@ class OutcomeEventsControllerTests : FunSpec({
404411 MockHelper .configModelStore(),
405412 MockHelper .identityModelStore { it.onesignalId = "onesignalId" },
406413 mockSubscriptionManager,
414+ MockHelper .deviceService(),
407415 MockHelper .time(now),
408416 )
409417
@@ -431,8 +439,8 @@ class OutcomeEventsControllerTests : FunSpec({
431439 evnt2.timestamp shouldBe 0 // timestamp only set when it had to be saved.
432440
433441 coVerifySequence {
434- mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", false, evnt1)
435- mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", true, evnt2)
442+ mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", " AndroidPush ", false, evnt1)
443+ mockOutcomeEventsBackend.sendOutcomeEvent(MockHelper .DEFAULT_APP_ID , "onesignalId", "subscriptionId", " AndroidPush ", true, evnt2)
436444 }
437445 }
438446
@@ -453,7 +461,7 @@ class OutcomeEventsControllerTests : FunSpec({
453461 val mockOutcomeEventsRepository = spyk<IOutcomeEventsRepository >()
454462 val mockOutcomeEventsPreferences = spyk<IOutcomeEventsPreferences >()
455463 val mockOutcomeEventsBackend = mockk<IOutcomeEventsBackendService >()
456- coEvery { mockOutcomeEventsBackend.sendOutcomeEvent(any(), any(), any(), any(), any()) } throws BackendException (408, null)
464+ coEvery { mockOutcomeEventsBackend.sendOutcomeEvent(any(), any(), any(), any(), any(), any() ) } throws BackendException (408, null)
457465
458466 val outcomeEventsController = OutcomeEventsController (
459467 mockSessionService,
@@ -464,6 +472,7 @@ class OutcomeEventsControllerTests : FunSpec({
464472 MockHelper .configModelStore(),
465473 MockHelper .identityModelStore(),
466474 mockSubscriptionManager,
475+ MockHelper .deviceService(),
467476 MockHelper .time(now),
468477 )
469478
@@ -500,12 +509,12 @@ class OutcomeEventsControllerTests : FunSpec({
500509 coEvery { mockOutcomeEventsRepository.cleanCachedUniqueOutcomeEventNotifications() } just runs
501510 coEvery { mockOutcomeEventsRepository.deleteOldOutcomeEvent(any()) } just runs
502511 coEvery { mockOutcomeEventsRepository.getAllEventsToSend() } returns listOf(
503- OutcomeEventParams ("outcomeId1", OutcomeSource (OutcomeSourceBody (JSONArray ().put("notificationId1")), null), .4f, 1111),
504- OutcomeEventParams ("outcomeId2", OutcomeSource (null, OutcomeSourceBody (JSONArray ().put("notificationId2").put("notificationId3"))), .2f, 2222),
512+ OutcomeEventParams ("outcomeId1", OutcomeSource (OutcomeSourceBody (JSONArray ().put("notificationId1")), null), .4f, 0, 1111),
513+ OutcomeEventParams ("outcomeId2", OutcomeSource (null, OutcomeSourceBody (JSONArray ().put("notificationId2").put("notificationId3"))), .2f, 0, 2222),
505514 )
506515 val mockOutcomeEventsPreferences = spyk<IOutcomeEventsPreferences >()
507516 val mockOutcomeEventsBackend = mockk<IOutcomeEventsBackendService >()
508- coEvery { mockOutcomeEventsBackend.sendOutcomeEvent(any(), any(), any(), any(), any()) } just runs
517+ coEvery { mockOutcomeEventsBackend.sendOutcomeEvent(any(), any(), any(), any(), any(), any() ) } just runs
509518
510519 val outcomeEventsController = OutcomeEventsController (
511520 mockSessionService,
@@ -516,6 +525,7 @@ class OutcomeEventsControllerTests : FunSpec({
516525 MockHelper .configModelStore(),
517526 MockHelper .identityModelStore { it.onesignalId = "onesignalId" },
518527 mockSubscriptionManager,
528+ MockHelper .deviceService(),
519529 MockHelper .time(now),
520530 )
521531
@@ -530,6 +540,7 @@ class OutcomeEventsControllerTests : FunSpec({
530540 "appId",
531541 "onesignalId",
532542 "subscriptionId",
543+ "AndroidPush ",
533544 true,
534545 withArg {
535546 it.name shouldBe "outcomeId1"
@@ -544,6 +555,7 @@ class OutcomeEventsControllerTests : FunSpec({
544555 "appId",
545556 "onesignalId",
546557 "subscriptionId",
558+ "AndroidPush ",
547559 false,
548560 withArg {
549561 it.name shouldBe "outcomeId2"
@@ -587,12 +599,12 @@ class OutcomeEventsControllerTests : FunSpec({
587599 val mockOutcomeEventsRepository = mockk<IOutcomeEventsRepository >()
588600 coEvery { mockOutcomeEventsRepository.cleanCachedUniqueOutcomeEventNotifications() } just runs
589601 coEvery { mockOutcomeEventsRepository.getAllEventsToSend() } returns listOf(
590- OutcomeEventParams ("outcomeId1", OutcomeSource (OutcomeSourceBody (JSONArray ().put("notificationId1")), null), .4f, 1111),
591- OutcomeEventParams ("outcomeId2", OutcomeSource (null, OutcomeSourceBody (JSONArray ().put("notificationId2").put("notificationId3"))), .2f, 2222),
602+ OutcomeEventParams ("outcomeId1", OutcomeSource (OutcomeSourceBody (JSONArray ().put("notificationId1")), null), .4f, 0, 1111),
603+ OutcomeEventParams ("outcomeId2", OutcomeSource (null, OutcomeSourceBody (JSONArray ().put("notificationId2").put("notificationId3"))), .2f, 0, 2222),
592604 )
593605 val mockOutcomeEventsPreferences = spyk<IOutcomeEventsPreferences >()
594606 val mockOutcomeEventsBackend = mockk<IOutcomeEventsBackendService >()
595- coEvery { mockOutcomeEventsBackend.sendOutcomeEvent(any(), any(), any(), any(), any()) } throws BackendException (408, null)
607+ coEvery { mockOutcomeEventsBackend.sendOutcomeEvent(any(), any(), any(), any(), any(), any() ) } throws BackendException (408, null)
596608
597609 val outcomeEventsController = OutcomeEventsController (
598610 mockSessionService,
@@ -603,6 +615,7 @@ class OutcomeEventsControllerTests : FunSpec({
603615 MockHelper .configModelStore(),
604616 MockHelper .identityModelStore { it.onesignalId = "onesignalId" },
605617 mockSubscriptionManager,
618+ MockHelper .deviceService(),
606619 MockHelper .time(now),
607620 )
608621
@@ -617,6 +630,7 @@ class OutcomeEventsControllerTests : FunSpec({
617630 "appId",
618631 "onesignalId",
619632 "subscriptionId",
633+ "AndroidPush ",
620634 true,
621635 withArg {
622636 it.name shouldBe "outcomeId1"
@@ -631,6 +645,7 @@ class OutcomeEventsControllerTests : FunSpec({
631645 "appId",
632646 "onesignalId",
633647 "subscriptionId",
648+ "AndroidPush ",
634649 false,
635650 withArg {
636651 it.name shouldBe "outcomeId2"
0 commit comments