From e09dba9d610578a425a6e25fbfab4bd5dfe45519 Mon Sep 17 00:00:00 2001 From: Nathaniel Brown Date: Fri, 1 Dec 2023 12:17:31 -0800 Subject: [PATCH] Need actual implementations for JVM --- .../sagebionetworks/bridge/kmm/shared/BaseTest.kt | 11 +++++++++++ .../bridge/kmm/shared/TestUtilsJvm.kt | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 bridge-client/src/jvmTest/kotlin/org/sagebionetworks/bridge/kmm/shared/BaseTest.kt create mode 100644 bridge-client/src/jvmTest/kotlin/org/sagebionetworks/bridge/kmm/shared/TestUtilsJvm.kt diff --git a/bridge-client/src/jvmTest/kotlin/org/sagebionetworks/bridge/kmm/shared/BaseTest.kt b/bridge-client/src/jvmTest/kotlin/org/sagebionetworks/bridge/kmm/shared/BaseTest.kt new file mode 100644 index 000000000..8fa4dd52d --- /dev/null +++ b/bridge-client/src/jvmTest/kotlin/org/sagebionetworks/bridge/kmm/shared/BaseTest.kt @@ -0,0 +1,11 @@ +package org.sagebionetworks.bridge.kmm.shared + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.runBlocking + +actual abstract class BaseTest actual constructor() { + + actual fun runTest(block: suspend CoroutineScope.() -> T) { + runBlocking { block() } + } +} \ No newline at end of file diff --git a/bridge-client/src/jvmTest/kotlin/org/sagebionetworks/bridge/kmm/shared/TestUtilsJvm.kt b/bridge-client/src/jvmTest/kotlin/org/sagebionetworks/bridge/kmm/shared/TestUtilsJvm.kt new file mode 100644 index 000000000..d3e0dfedc --- /dev/null +++ b/bridge-client/src/jvmTest/kotlin/org/sagebionetworks/bridge/kmm/shared/TestUtilsJvm.kt @@ -0,0 +1,14 @@ +package org.sagebionetworks.bridge.kmm.shared + +import app.cash.sqldelight.db.SqlDriver +import app.cash.sqldelight.driver.jdbc.sqlite.JdbcSqliteDriver +import org.sagebionetworks.bridge.kmm.shared.cache.BridgeResourceDatabase +import java.util.UUID + +internal actual fun testDatabaseDriver(): SqlDriver { + return JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY).apply { + BridgeResourceDatabase.Schema.create(this) + } + } + +internal actual fun randomUUID() = UUID.randomUUID().toString() \ No newline at end of file