Skip to content
Merged
Prev Previous commit
Next Next commit
[[BF103]](#103) Moved SignUpTest to commonMain
  • Loading branch information
andylamax committed Oct 4, 2021
commit 2a0536eb8547ec99fdda807bbfcb066aa0c064cd
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 0.0.29

## PiMonitor Client SDK Core

- [[BF103]](https://github.com/picortex/bitframe/issues/103) Moved SignUpTest to commonMain

## Bitframe Authentication Service

### Bug Fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class TestClientConfiguration @JvmOverloads private constructor(
simulationTime: Int = DEFAULT_SIMULATION_TIME,
scope: CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
) = invoke(appId, simulationTime, scope)

@JvmStatic
fun from(config: ServiceConfig, appId: String) = invoke(appId, scope = config.scope)
}

fun toDaoConfig() = TestDaoConfig(simulationTime, scope)
Expand Down
8 changes: 2 additions & 6 deletions pi-monitor/pi-monitor-client/sdks/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ kotlin {
js(IR) {
val main by compilations
main.outputModuleName = "pi-monitor-client-sdk-core"
browserLib()
library()
binaries.library()
}

Expand All @@ -32,15 +32,11 @@ kotlin {

val commonTest by getting {
dependencies {
implementation(project(":pi-monitor-test-testing"))
implementation(asoft("expect-coroutines", vers.asoft.expect))
}
}

val jvmMain by getting {
dependencies {
implementation(project(":pi-monitor-test-testing"))
}
}
val jsMain by getting {
dependencies {
api(kotlinx("coroutines-core", vers.kotlinx.coroutines))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package acceptance.authentication
package core.authentication

import bitframe.authentication.signin.SignInCredentials
import pimonitor.authentication.signup.IndividualRegistrationParams

internal fun IndividualRegistrationParams.credentials() = SignInCredentials(
alias = email.toString(),
password = password.toString()
alias = email,
password = password
)
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package acceptance.authentication
package core.authentication

import acceptance.utils.IntegrationTest
import expect.expect
import kotlinx.coroutines.runTest
import kotlinx.datetime.Clock
import later.await
import org.junit.jupiter.api.TestInstance
import org.testcontainers.junit.jupiter.Testcontainers
import pimonitor.authentication.signup.IndividualRegistrationParams
import pimonitor.PiMonitorService
import pimonitor.ktor.PiMonitorServiceKtor
import pimonitor.authentication.signup.IndividualRegistrationParams
import testing.IntegrationTest
import testing.annotations.Lifecycle
import testing.annotations.TestInstance
import testing.annotations.Testcontainers
import kotlin.test.Test

@Testcontainers
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class SignUpServiceKtorServiceTest : IntegrationTest() {
@TestInstance(Lifecycle.PER_CLASS)
abstract class SignUpServiceTest : IntegrationTest() {

private val service: PiMonitorService by lazy { PiMonitorServiceKtor(config) }
abstract val service: PiMonitorService

@Test
fun should_register_an_individual() = runTest {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package integration.authentication

import bitframe.authentication.TestClientConfiguration
import bitframe.service.config.KtorClientConfiguration
import core.authentication.SignUpServiceTest
import expect.expect
import pimonitor.PiMonitorService
import pimonitor.ktor.PiMonitorServiceKtor
import pimonitor.test.PiMonitorServiceTest
import testing.annotations.Lifecycle
import testing.annotations.TestInstance
import testing.annotations.Testcontainers
import kotlin.test.Test

@Testcontainers
@TestInstance(Lifecycle.PER_CLASS)
class SignUpServiceIntegrationTest : SignUpServiceTest() {

override val service: PiMonitorService by lazy {
when (val cfg = config) {
is KtorClientConfiguration -> PiMonitorServiceKtor(cfg)
else -> PiMonitorServiceTest(TestClientConfiguration.from(cfg, "test-app"))
}
}

@Test
fun should_pass() {
expect(1 + 1).toBe(2)
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package unit.authentication

import bitframe.authentication.TestClientConfiguration
import bitframe.service.config.KtorClientConfiguration
import core.authentication.SignUpServiceTest
import expect.expect
import pimonitor.PiMonitorService
import pimonitor.ktor.PiMonitorServiceKtor
import pimonitor.test.PiMonitorServiceTest
import testing.annotations.Lifecycle
import testing.annotations.TestInstance
import testing.annotations.Testcontainers
import kotlin.test.Test

@Testcontainers
@TestInstance(Lifecycle.PER_CLASS)
class SignUpServiceUnitTest : SignUpServiceTest() {

override val service: PiMonitorService by lazy {
PiMonitorServiceTest(TestClientConfiguration.from(config, "test-app"))
}

@Test
fun should_pass() {
expect(1 + 1).toBe(2)
}
}

This file was deleted.

This file was deleted.

This file was deleted.