Skip to content

Commit 235d75a

Browse files
author
heodongun
committed
test: add shared shutdown registry helper
1 parent 63253c1 commit 235d75a

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)