Skip to content

Commit d9fb9b9

Browse files
committed
add AppTest to test Firebase.initialize
1 parent 4db1e48 commit d9fb9b9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/test/kotlin/AppTest.kt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import android.app.Application
2+
import com.google.firebase.Firebase
3+
import com.google.firebase.FirebaseOptions
4+
import com.google.firebase.FirebasePlatform
5+
import com.google.firebase.initialize
6+
import org.junit.Test
7+
8+
9+
class AppTest {
10+
@Test
11+
fun testInitialize() {
12+
FirebasePlatform.initializeFirebasePlatform(object : FirebasePlatform() {
13+
val storage = mutableMapOf<String, String>()
14+
override fun store(key: String, value: String) = storage.set(key, value)
15+
override fun retrieve(key: String) = storage[key]
16+
override fun clear(key: String) { storage.remove(key) }
17+
override fun log(msg: String) = println(msg)
18+
})
19+
val options = FirebaseOptions.Builder()
20+
.setProjectId("my-firebase-project")
21+
.setApplicationId("1:27992087142:android:ce3b6448250083d1")
22+
.setApiKey("AIzaSyADUe90ULnQDuGShD9W23RDP0xmeDc6Mvw")
23+
// setDatabaseURL(...)
24+
// setStorageBucket(...)
25+
.build()
26+
val app = Firebase.initialize(Application(), options)
27+
28+
}
29+
}

0 commit comments

Comments
 (0)