We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ee95366 commit ff20867Copy full SHA for ff20867
1 file changed
src/test/kotlin/com/cotor/testsupport/ServiceLifecycleExtensions.kt
@@ -0,0 +1,16 @@
1
+package com.cotor.testsupport
2
+
3
+import com.cotor.app.DesktopAppService
4
5
+/**
6
+ * Guarantees DesktopAppService background jobs are stopped even when a test fails.
7
+ */
8
+suspend fun <T> withDesktopServiceShutdown(
9
+ service: DesktopAppService,
10
+ block: suspend () -> T
11
+): T =
12
+ try {
13
+ block()
14
+ } finally {
15
+ service.shutdown()
16
+ }
0 commit comments