@@ -5,6 +5,8 @@ import com.onesignal.common.threading.suspendifyOnIO
55import com.onesignal.debug.LogLevel
66import com.onesignal.debug.internal.logging.Logging
77import com.onesignal.mocks.AndroidMockHelper
8+ import com.onesignal.mocks.IOMockHelper
9+ import com.onesignal.mocks.IOMockHelper.awaitIO
810import com.onesignal.mocks.MockHelper
911import com.onesignal.notifications.INotificationReceivedEvent
1012import com.onesignal.notifications.INotificationWillDisplayEvent
@@ -96,6 +98,9 @@ private class Mocks {
9698}
9799
98100class 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