@@ -8,7 +8,6 @@ import dev.gitlive.firebase.runBlockingTest
88import dev.gitlive.firebase.runTest
99import kotlinx.coroutines.Dispatchers
1010import kotlinx.coroutines.flow.first
11- import kotlinx.coroutines.flow.map
1211import kotlinx.coroutines.withContext
1312import kotlinx.coroutines.withTimeout
1413import kotlinx.serialization.Serializable
@@ -33,7 +32,7 @@ class FirebaseDatabaseTest {
3332 lateinit var database: FirebaseDatabase
3433
3534 @Serializable
36- data class FirebaseDatabaseChildTest (val prop1 : String? = null , val time : Double = 0.0 )
35+ data class FirebaseDatabaseChildTest (val prop1 : String? = null , val time : Double = 0.0 , val boolean : Boolean = true )
3736
3837 @Serializable
3938 data class DatabaseTest (val title : String , val likes : Int = 0 )
@@ -198,6 +197,29 @@ class FirebaseDatabaseTest {
198197 assertFalse(valueEvents.first().exists)
199198 }
200199
200+ @Test
201+ fun testBooleanValue () = runTest {
202+ ensureDatabaseConnected()
203+ val reference = database.reference(" FirebaseRealtimeDatabaseBooleanTest" )
204+ val falseRef = reference.child(" false" )
205+ val trueRef = reference.child(" true" )
206+ falseRef.setValue(false )
207+ trueRef.setValue(true )
208+ val falseValue = falseRef.valueEvents.first().value<Boolean >()
209+ val trueValue = trueRef.valueEvents.first().value<Boolean >()
210+ assertFalse(falseValue)
211+ assertTrue(trueValue)
212+ }
213+
214+ @Test
215+ fun testBooleanValueInChild () = runTest {
216+ ensureDatabaseConnected()
217+ val reference = database.reference(" FirebaseRealtimeDatabaseBooleanInChildTest" )
218+ reference.setValue(FirebaseDatabaseChildTest ())
219+ val value = reference.valueEvents.first().value<FirebaseDatabaseChildTest >()
220+ assertEquals(FirebaseDatabaseChildTest (), value)
221+ }
222+
201223 // Ignoring on Android Instrumented Tests due to bug in Firebase: https://github.com/firebase/firebase-android-sdk/issues/5870
202224 @IgnoreForAndroidTest
203225 @Test
0 commit comments