Skip to content

Commit f9d77ba

Browse files
committed
get tests building
1 parent 86a3a6e commit f9d77ba

File tree

16 files changed

+140
-28
lines changed

16 files changed

+140
-28
lines changed

build.gradle.kts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,6 @@ subprojects {
107107
afterEvaluate {
108108

109109
dependencies {
110-
"jvmMainApi"("dev.gitlive:firebase-java-sdk:0.1.1")
111-
"jvmMainApi"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.0") {
112-
exclude("com.google.android.gms")
113-
}
114110
"commonMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
115111
"androidMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.4")
116112
"androidMainImplementation"(platform("com.google.firebase:firebase-bom:31.4.0"))
@@ -119,7 +115,13 @@ subprojects {
119115
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
120116
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
121117
if (this@afterEvaluate.name != "firebase-crashlytics") {
118+
"jvmMainApi"("dev.gitlive:firebase-java-sdk:0.1.1")
119+
"jvmMainApi"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.0") {
120+
exclude("com.google.android.gms")
121+
}
122122
"jsTestImplementation"(kotlin("test-js"))
123+
"jvmTestImplementation"(kotlin("test-junit"))
124+
"jvmTestImplementation"("junit:junit:4.13.2")
123125
}
124126
"androidAndroidTestImplementation"(kotlin("test-junit"))
125127
"androidAndroidTestImplementation"("junit:junit:4.13.2")

firebase-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-app",
3-
"version": "1.8.2",
3+
"version": "1.9.2",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-app.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-common": "1.8.2",
26+
"@gitlive/firebase-common": "1.9.2",
2727
"firebase": "9.19.1",
2828
"kotlin": "1.8.20",
2929
"kotlinx-coroutines-core": "1.6.4"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright (c) 2020 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
@file:JvmName("tests")
6+
package dev.gitlive.firebase
7+
8+
actual val context: Any = Unit
9+
10+
actual fun runTest(test: suspend () -> Unit) = kotlinx.coroutines.test.runTest { test() }

firebase-auth/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ android {
3535
getByName("main") {
3636
manifest.srcFile("src/androidMain/AndroidManifest.xml")
3737
}
38-
getByName("androidTest"){
38+
getByName("androidTest") {
3939
java.srcDir(file("src/androidAndroidTest/kotlin"))
4040
manifest.srcFile("src/androidAndroidTest/AndroidManifest.xml")
4141
}
@@ -139,6 +139,7 @@ kotlin {
139139
api("com.google.firebase:firebase-auth")
140140
}
141141
}
142+
142143
val jvmMain by getting {
143144
kotlin.srcDir("src/androidMain/kotlin")
144145
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright (c) 2020 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
@file:JvmName("tests")
6+
package dev.gitlive.firebase.auth
7+
8+
9+
actual val emulatorHost: String = "10.0.2.2"
10+
11+
actual val context: Any = Unit
12+
13+
actual fun runTest(test: suspend () -> Unit) = kotlinx.coroutines.test.runTest { test() }

firebase-common/build.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ android {
2323
getByName("main") {
2424
manifest.srcFile("src/androidMain/AndroidManifest.xml")
2525
}
26-
getByName("androidTest").java.srcDir(file("src/androidAndroidTest/kotlin"))
26+
getByName("androidTest") {
27+
java.srcDir(file("src/androidAndroidTest/kotlin"))
28+
manifest.srcFile("src/androidAndroidTest/AndroidManifest.xml")
29+
}
2730
}
2831
testOptions {
2932
unitTests.apply {
@@ -105,6 +108,7 @@ kotlin {
105108

106109
val commonTest by getting {
107110
dependencies {
111+
implementation(project(":test-utils"))
108112
}
109113
}
110114

firebase-common/src/commonTest/kotlin/dev/gitlive/firebase/EncodersTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import kotlinx.serialization.builtins.ListSerializer
1010
import kotlin.test.Test
1111
import kotlin.test.assertEquals
1212
import kotlin.test.assertNull
13+
import dev.gitlive.firebase.nativeAssertEquals
14+
import dev.gitlive.firebase.nativeMapOf
1315

1416
@Serializable
1517
data class TestData(val map: Map<String, String>, val bool: Boolean = false, val nullableBool: Boolean? = null)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright (c) 2020 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
@file:JvmName("tests")
6+
package dev.gitlive.firebase.remoteconfig
7+
8+
actual val context: Any = Unit
9+
10+
actual fun runTest(test: suspend () -> Unit) = kotlinx.coroutines.test.runTest { test() }

firebase-crashlytics/build.gradle.kts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ android {
2222
getByName("main") {
2323
manifest.srcFile("src/androidMain/AndroidManifest.xml")
2424
}
25-
getByName("androidTest"){
25+
getByName("androidTest") {
2626
java.srcDir(file("src/androidAndroidTest/kotlin"))
2727
manifest.srcFile("src/androidAndroidTest/AndroidManifest.xml")
2828
}
@@ -50,18 +50,18 @@ kotlin {
5050
publishAllLibraryVariants()
5151
}
5252

53-
jvm {
54-
val main by compilations.getting {
55-
kotlinOptions {
56-
jvmTarget = "17"
57-
}
58-
}
59-
val test by compilations.getting {
60-
kotlinOptions {
61-
jvmTarget = "17"
62-
}
63-
}
64-
}
53+
// jvm {
54+
// val main by compilations.getting {
55+
// kotlinOptions {
56+
// jvmTarget = "17"
57+
// }
58+
// }
59+
// val test by compilations.getting {
60+
// kotlinOptions {
61+
// jvmTarget = "17"
62+
// }
63+
// }
64+
// }
6565

6666
if (supportIosTarget) {
6767
ios()

firebase-database/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ kotlin {
5656
jvmTarget = "17"
5757
}
5858
}
59+
val test by compilations.getting {
60+
kotlinOptions {
61+
jvmTarget = "17"
62+
}
63+
}
5964
}
6065

6166
if (supportIosTarget) {

0 commit comments

Comments
 (0)