Skip to content

Commit

Permalink
kmp api unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
crc-32 committed Aug 30, 2024
1 parent 3c8bd2a commit 6c52f3e
Show file tree
Hide file tree
Showing 4 changed files with 1,460 additions and 2 deletions.
1 change: 1 addition & 0 deletions android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ libpebblecommon = { module = "io.rebble.libpebblecommon:libpebblecommon", versio
uuid = { module = "com.benasher44:uuid", version.ref = "uuidVersion" }

ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktorVersion" }
ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktorVersion" }
ktor-client-contentnegotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktorVersion" }
ktor-serialization-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktorVersion" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktorVersion" }
1 change: 1 addition & 0 deletions android/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ kotlin {
}
commonTest.dependencies {
implementation(kotlin("test"))
implementation(libs.ktor.client.mock)
}
}
room {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.rebble.cobble.shared.api

import io.ktor.client.HttpClient
import io.ktor.client.call.body
import io.ktor.client.engine.HttpClientEngine
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
import io.ktor.client.request.*
import io.ktor.http.HttpHeaders
Expand All @@ -10,10 +11,15 @@ import io.rebble.cobble.shared.domain.api.appstore.LockerEntry

class AppstoreClient(
val baseUrl: String,
private val token: String
private val token: String,
engine: HttpClientEngine? = null,
) {
private val version = "v1"
private val client = HttpClient {
private val client = engine?.let { HttpClient(it) {
install(ContentNegotiation) {
json()
}
}} ?: HttpClient {
install(ContentNegotiation) {
json()
}
Expand Down
Loading

0 comments on commit 6c52f3e

Please sign in to comment.