From 0491c78c7f1053b6e54a98916ad6605de46d5430 Mon Sep 17 00:00:00 2001 From: TapTap Date: Sun, 15 Nov 2026 18:52:23 +0000 Subject: [PATCH] test: cancel leftover store jobs via backgroundScope The reconnect loop could outlive the test body and intermittently fail runTest with UncompletedCoroutinesError. --- .../kotlin/win/taptap/musicmanager/client/AppStoreTest.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composeApp/src/commonTest/kotlin/win/taptap/musicmanager/client/AppStoreTest.kt b/composeApp/src/commonTest/kotlin/win/taptap/musicmanager/client/AppStoreTest.kt index f59805c..7a34281 100644 --- a/composeApp/src/commonTest/kotlin/win/taptap/musicmanager/client/AppStoreTest.kt +++ b/composeApp/src/commonTest/kotlin/win/taptap/musicmanager/client/AppStoreTest.kt @@ -608,7 +608,10 @@ class AppStoreTest { cache: LibraryCache, player: AudioPlayer, ): AppStore = AppStore( - scope = this, + // Background scope so leftover store jobs (reconnect loops, refreshes) + // are cancelled by runTest instead of failing the next test with + // UncompletedCoroutinesError. + scope = backgroundScope, api = ApiClient(configuredHttpClient(MockEngine { respondError(HttpStatusCode.NotFound) })), storage = storage, player = player,