From 703d3a398405b574e370958d8e8d3a0f1e44b4ff Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Sat, 17 Oct 2026 21:34:24 +0200 Subject: [PATCH] test: wait for the insurance request in OfflineFirstChatRepositoryTest The insurance request goes through ChatMessageSyncer's pull flow, which runs on Dispatchers.IO. runCurrent() only drains the test dispatcher, so the verify could run before the IO thread reached the network mock and the test failed with WantedButNotInvoked on busy CI runners. Verify with a timeout, as the long polling test in the same class does. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger --- .../chat/data/network/OfflineFirstChatRepositoryTest.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/test/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepositoryTest.kt b/app/src/test/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepositoryTest.kt index e9078eb57e5..9accbc85499 100644 --- a/app/src/test/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepositoryTest.kt +++ b/app/src/test/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepositoryTest.kt @@ -280,10 +280,12 @@ class OfflineFirstChatRepositoryTest { runCurrent() verifyBlocking(network, never()) { pullChatMessages(any(), any(), any()) } - // ... and the request is sent on it + // ... and the request is sent on it, from the pull flow on Dispatchers.IO that runCurrent doesn't wait for advanceTimeBy(INSURANCE_DELAY_MS / 2) runCurrent() - verifyBlocking(network, times(1)) { pullChatMessages(eq(CREDENTIALS), eq(CHAT_URL), any()) } + verifyBlocking(network, timeout(AWAIT_TIMEOUT_MILLIS).times(1)) { + pullChatMessages(eq(CREDENTIALS), eq(CHAT_URL), any()) + } polling.cancelAndJoin() }