Skip to content

Commit de2d1e2

Browse files
committed
Switch firebase-database tests to karma
1 parent d66734c commit de2d1e2

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

firebase-database/build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ kotlin {
7070
useCommonJs()
7171
nodejs {
7272
testTask {
73-
useMocha {
74-
timeout = "5s"
73+
useKarma {
74+
useChromeHeadless()
7575
}
7676
}
7777
}
7878
browser {
7979
testTask {
80-
useMocha {
81-
timeout = "5s"
80+
useKarma {
81+
useChromeHeadless()
8282
}
8383
}
8484
}

firebase-database/src/jsTest/kotlin/dev/gitlive/firebase/database/database.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@ import kotlinx.coroutines.withContext
1010
import kotlinx.coroutines.withTimeout
1111
import kotlin.time.Duration.Companion.seconds
1212

13-
actual val emulatorHost: String = "127.0.0.1" // in JS connection is refused if we use localhost
13+
actual val emulatorHost: String = "127.0.0.1" // in JS tests connection is refused if we use localhost
1414

1515
actual val context: Any = Unit
1616
actual fun runTest(test: suspend () -> Unit) = kotlinx.coroutines.test.runTest {
17-
val db = getDatabase()
18-
goOnline(db)
17+
// in JS tests we need to wait for the database to be connected
1918
awaitDatabaseConnection()
2019
test()
21-
// in JS tests are running infinitely without going database offline
22-
goOffline(db)
2320
}
2421

2522
private suspend fun awaitDatabaseConnection() = withContext(Dispatchers.Default) {

0 commit comments

Comments
 (0)