File tree Expand file tree Collapse file tree
mobile/shared/src/commonTest/kotlin/app/myfaq/shared/api Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343 distribution : temurin
4444 java-version : ' 17'
4545 - uses : gradle/actions/setup-gradle@v4
46- - run : ./gradlew :shared:testDebugUnitTest :shared:jvmTest --stacktrace
46+ - run : ./gradlew :shared:testDebugUnitTest --stacktrace
4747 - uses : actions/upload-artifact@v4
4848 if : always()
4949 with :
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import io.ktor.http.HttpStatusCode
99import io.ktor.http.headersOf
1010import io.ktor.serialization.kotlinx.json.json
1111import io.ktor.utils.io.ByteReadChannel
12+ import kotlinx.coroutines.runBlocking
1213import kotlinx.coroutines.test.runTest
1314import kotlinx.serialization.json.Json
1415import kotlin.test.Test
@@ -55,13 +56,15 @@ class MyFaqApiTest {
5556
5657 @Test
5758 fun `meta loader renders success string` () =
58- runTest {
59+ runBlocking {
5960 val api = MyFaqApiImpl (client(FULL_FIXTURE ), baseUrl = " https://example.test" )
6061 val loader = MetaLoader (api, scope = this )
61- var result: String? = null
62- loader.load(onSuccess = { result = it }, onError = { result = " err: $it " })
63- testScheduler.advanceUntilIdle()
64- assertEquals(" MyFAQ.app test instance — phpMyFAQ 4.2.0" , result)
62+ val deferred = kotlinx.coroutines.CompletableDeferred <String >()
63+ loader.load(
64+ onSuccess = { deferred.complete(it) },
65+ onError = { deferred.complete(" err: $it " ) },
66+ )
67+ assertEquals(" MyFAQ.app test instance — phpMyFAQ 4.2.0" , deferred.await())
6568 }
6669
6770 private companion object {
You can’t perform that action at this time.
0 commit comments