File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
src/jsTest/kotlin/co/pokeapi/pokekotlin/test Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ kotlin {
47
47
js(IR ) {
48
48
browser { testTask { useMocha { timeout = " 10min" } } }
49
49
nodejs { testTask { useMocha { timeout = " 10min" } } }
50
-
50
+ useEsModules()
51
51
binaries.library()
52
52
generateTypeScriptDefinitions()
53
53
}
Original file line number Diff line number Diff line change 1
1
package co.pokeapi.pokekotlin.test
2
2
3
3
import co.pokeapi.pokekotlin.PokeApi
4
- import io.ktor.client.plugins.*
5
- import io.ktor.http.*
4
+ import io.ktor.client.plugins.ClientRequestException
5
+ import io.ktor.http.HttpStatusCode
6
6
import kotlin.js.Promise
7
7
import kotlin.test.Test
8
8
import kotlin.test.assertEquals
@@ -12,12 +12,12 @@ import kotlinx.coroutines.test.runTest
12
12
13
13
@Suppress(" UnusedVariable" , " unused" )
14
14
class LiveJsTest {
15
- private val client: PokeApi =
16
- js(" require ('./pokekotlin.js ').co.pokeapi.pokekotlin. PokeApi.Default" )
15
+ private val client: Promise < PokeApi > =
16
+ js(" import ('./pokekotlin.mjs ').then(function (it) { return it. PokeApi.Default; }) " )
17
17
18
18
@Test
19
19
fun resource () = runTest {
20
- val client = client
20
+ val client = client.await()
21
21
assertEquals(
22
22
" sitrus" ,
23
23
js(" client.getBerryAsync(10).then(function (it) { return it.name; })" )
@@ -28,7 +28,7 @@ class LiveJsTest {
28
28
29
29
@Test
30
30
fun list () = runTest {
31
- val client = client
31
+ val client = client.await()
32
32
33
33
val berry1 =
34
34
js(" client.getBerryListAsync(0, 10).then(function (it) { return it.results[5]; })" )
@@ -45,7 +45,7 @@ class LiveJsTest {
45
45
46
46
@Test
47
47
fun notFound () = runTest {
48
- val client = client
48
+ val client = client.await()
49
49
50
50
val exception =
51
51
assertFailsWith<ClientRequestException > {
You can’t perform that action at this time.
0 commit comments