Skip to content

Commit 4b10698

Browse files
committed
add IOMockHelper to NotificationGenerationProcessorTests
1 parent f1f4f11 commit 4b10698

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

OneSignalSDK/onesignal/notifications/src/test/java/com/onesignal/notifications/internal/generation/NotificationGenerationProcessorTests.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import com.onesignal.common.threading.suspendifyOnIO
55
import com.onesignal.debug.LogLevel
66
import com.onesignal.debug.internal.logging.Logging
77
import com.onesignal.mocks.AndroidMockHelper
8+
import com.onesignal.mocks.IOMockHelper
9+
import com.onesignal.mocks.IOMockHelper.awaitIO
810
import com.onesignal.mocks.MockHelper
911
import com.onesignal.notifications.INotificationReceivedEvent
1012
import com.onesignal.notifications.INotificationWillDisplayEvent
@@ -96,6 +98,9 @@ private class Mocks {
9698
}
9799

98100
class NotificationGenerationProcessorTests : FunSpec({
101+
102+
listener(IOMockHelper)
103+
99104
beforeAny {
100105
Logging.logLevel = LogLevel.NONE
101106

@@ -277,15 +282,14 @@ class NotificationGenerationProcessorTests : FunSpec({
277282
val willDisplayEvent = firstArg<INotificationWillDisplayEvent>()
278283
willDisplayEvent.preventDefault(false)
279284
suspendifyOnIO {
280-
delay(100)
281285
willDisplayEvent.preventDefault(true)
282-
delay(100)
283286
willDisplayEvent.notification.display()
284287
}
285288
}
286289

287290
// When
288291
mocks.notificationGenerationProcessor.processNotificationData(mocks.context, 1, mocks.notificationPayload, false, 1111)
292+
awaitIO()
289293

290294
// Then
291295
coVerify(exactly = 0) {
@@ -301,15 +305,14 @@ class NotificationGenerationProcessorTests : FunSpec({
301305
val receivedEvent = firstArg<INotificationReceivedEvent>()
302306
receivedEvent.preventDefault(false)
303307
suspendifyOnIO {
304-
delay(100)
305308
receivedEvent.preventDefault(true)
306-
delay(100)
307309
receivedEvent.notification.display()
308310
}
309311
}
310312

311313
// When
312314
mocks.notificationGenerationProcessor.processNotificationData(mocks.context, 1, mocks.notificationPayload, true, 1111)
315+
awaitIO()
313316

314317
// Then
315318
coVerify(exactly = 0) {

0 commit comments

Comments
 (0)