Skip to content

Commit 74c3722

Browse files
committed
Fix js tests
1 parent d5351e4 commit 74c3722

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ group = GROUP
3737
version = VERSION_NAME
3838

3939
kotlin {
40-
targets {
4140
jvm()
4241
js {
4342
browser()
@@ -56,7 +55,6 @@ kotlin {
5655
linuxArm32Hfp()
5756
linuxMips32()
5857
mingwX64()
59-
}
6058
sourceSets {
6159
commonMain {
6260
dependencies {

src/jsMain/kotlin/co/touchlab/testhelp/concurrency/ThreadOperations.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ import kotlin.js.Date
55
actual class MPWorker actual constructor() {
66

77
actual fun <T> runBackground(backJob: () -> T): MPFuture<T> {
8-
return MPFuture(backJob())
8+
return MPFuture(backJob)
99
}
1010

1111
actual fun requestTermination() {
1212
}
1313
}
1414

15-
actual class MPFuture<T>(val result: T) {
16-
actual fun consume(): T = result
15+
actual class MPFuture<T>(job: () -> T) {
16+
private val result: Result<T> = runCatching(job)
17+
18+
actual fun consume(): T = result.getOrThrow()
1719
}
1820

1921
actual fun sleep(time: Long) {

0 commit comments

Comments
 (0)