Skip to content

Commit c3f63a0

Browse files
author
Martynas Petuška
committed
Kotlin 1.4.0-rc further cleanup
1 parent a39c0c4 commit c3f63a0

File tree

6 files changed

+103
-117
lines changed

6 files changed

+103
-117
lines changed

examples/todos/common/build.gradle

Lines changed: 0 additions & 96 deletions
This file was deleted.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
plugins {
2+
java
3+
kotlin("multiplatform")
4+
}
5+
6+
repositories {
7+
maven("https://dl.bintray.com/spekframework/spek-dev")
8+
}
9+
10+
kotlin {
11+
jvm()
12+
js(IR) {
13+
binaries.executable()
14+
15+
listOf(compilations["main"], compilations["test"]).forEach {
16+
with(it.kotlinOptions) {
17+
moduleKind = "umd"
18+
sourceMap = true
19+
sourceMapEmbedSources = "always"
20+
metaInfo = true
21+
}
22+
}
23+
}
24+
25+
iosArm64("ios")
26+
iosX64("iosSim")
27+
macosX64("macos")
28+
mingwX64("win")
29+
wasm32("wasm")
30+
linuxArm32Hfp("linArm32")
31+
linuxMips32("linMips32")
32+
linuxMipsel32("linMipsel32")
33+
linuxX64("lin64")
34+
35+
sourceSets {
36+
commonMain {
37+
dependencies {
38+
implementation(project(":redux-kotlin-threadsafe"))
39+
}
40+
}
41+
commonTest {
42+
kotlin.srcDir("src/test/kotlin")
43+
dependencies {
44+
implementation(kotlin("test-common"))
45+
implementation(kotlin("test-annotations-common"))
46+
implementation("org.spekframework.spek2:spek-dsl-metadata:${Versions.spek}")
47+
implementation("ch.tutteli.atrium:atrium-cc-en_GB-robstoll-common:${Versions.atrium}")
48+
implementation("io.mockk:mockk-common:${Versions.mockk}")
49+
}
50+
}
51+
val jvmTest by getting {
52+
dependencies {
53+
implementation(kotlin("test"))
54+
implementation(kotlin("test-junit"))
55+
implementation("org.spekframework.spek2:spek-dsl-jvm:${Versions.spek}")
56+
implementation("ch.tutteli.atrium:atrium-cc-en_GB-robstoll:${Versions.atrium}")
57+
implementation("io.mockk:mockk:${Versions.mockk}")
58+
59+
runtimeOnly("org.spekframework.spek2:spek-runner-junit5:${Versions.spek}")
60+
runtimeOnly("org.jetbrains.kotlin:kotlin-reflect")
61+
}
62+
}
63+
val jsTest by getting {
64+
dependencies {
65+
implementation(kotlin("test-js"))
66+
implementation(kotlin("stdlib-js"))
67+
}
68+
}
69+
70+
val iosMain by getting
71+
val iosTest by getting
72+
val iosSimMain by getting { dependsOn(iosMain) }
73+
val iosSimTest by getting { dependsOn(iosTest) }
74+
}
75+
}
76+
77+
tasks {
78+
val jvmTest by getting(Test::class) {
79+
useJUnitPlatform {
80+
includeEngines("spek2")
81+
}
82+
}
83+
}

redux-kotlin-threadsafe/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ kotlin {
3939
}
4040
}
4141
commonTest {
42-
kotlin.srcDir("src/test/kotlin")
4342
dependencies {
4443
implementation(kotlin("test-common"))
4544
implementation(kotlin("test-annotations-common"))

redux-kotlin/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ kotlin {
3333

3434
sourceSets {
3535
commonTest {
36-
kotlin.srcDir("src/test/kotlin")
3736
dependencies {
3837
implementation(kotlin("test-common"))
3938
implementation(kotlin("test-annotations-common"))

redux-kotlin/src/test/kotlin/org/reduxkotlin/ApplyMiddlewareTest.kt renamed to redux-kotlin/src/commonTest/kotlin/org/reduxkotlin/ApplyMiddlewareTest.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package org.reduxkotlin
22

3-
import ch.tutteli.atrium.api.cc.en_GB.toThrow
4-
import ch.tutteli.atrium.domain.creating.AnyAssertions
53
import ch.tutteli.atrium.verbs.expect
64
import org.spekframework.spek2.Spek
75
import org.spekframework.spek2.style.specification.describe
@@ -11,7 +9,7 @@ object ApplyMiddlewareSpec : Spek({
119
describe("applyMiddleware") {
1210
it("warns when dispatching during middleware setup") {
1311
fun dispatchingMiddleware(store: Store<TestState>): (next: Dispatcher) -> (action: Any) -> Any {
14-
store.dispatch(AddTodo("1", "Dont dispatch in middleware setup"));
12+
store.dispatch(AddTodo("1", "Dont dispatch in middleware setup"))
1513
return { next ->
1614
{ action ->
1715
{
@@ -24,7 +22,7 @@ object ApplyMiddlewareSpec : Spek({
2422
expect {
2523
val storeEnhancer: StoreEnhancer<TestState> = applyMiddleware(::dispatchingMiddleware)
2624
createStore(todos, TestState(), storeEnhancer)
27-
}.toThrow<Exception> {}
25+
}.toThrow<Exception>().asAssert({})
2826
}
2927

3028
/*

redux-kotlin/src/test/kotlin/org/reduxkotlin/CreateStoreSpec.kt renamed to redux-kotlin/src/commonTest/kotlin/org/reduxkotlin/CreateStoreSpec.kt

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package org.reduxkotlin
22

3-
import ch.tutteli.atrium.api.cc.en_GB.toBe
3+
import ch.tutteli.atrium.api.fluent.en_GB.toBe
4+
import ch.tutteli.atrium.creating.Assert
5+
import ch.tutteli.atrium.domain.builders.migration.asAssert
6+
import ch.tutteli.atrium.domain.builders.migration.asExpect
47
import ch.tutteli.atrium.verbs.expect
58
import org.spekframework.spek2.Spek
69
import org.spekframework.spek2.style.specification.describe
@@ -19,7 +22,7 @@ object CreateStoreSpec : Spek({
1922
)
2023
)
2124

22-
expect(store.getState()).toBe(
25+
expect(store.getState()).asExpect<TestState, Assert<TestState>>().toBe(
2326
TestState(
2427
listOf(
2528
Todo(
@@ -28,17 +31,17 @@ object CreateStoreSpec : Spek({
2831
)
2932
)
3033
)
31-
)
34+
).asAssert()
3235
}
3336
it("applies the reducer to the previous state") {
3437
val store = createStore(todos, TestState())
35-
expect(store.getState()).toBe(TestState())
38+
expect(store.getState()).asExpect<TestState, Assert<TestState>>().toBe(TestState()).asAssert()
3639

3740
store.dispatch(Any())
38-
expect(store.getState()).toBe(TestState())
41+
expect(store.getState()).asExpect<TestState, Assert<TestState>>().toBe(TestState()).asAssert()
3942

4043
store.dispatch(AddTodo("1", "Hello"))
41-
expect(store.getState()).toBe(
44+
expect(store.getState()).asExpect<TestState, Assert<TestState>>().toBe(
4245
TestState(
4346
listOf(
4447
Todo(
@@ -47,11 +50,11 @@ object CreateStoreSpec : Spek({
4750
)
4851
)
4952
)
50-
)
53+
).asAssert()
5154

5255
//TODO are ids autoincrement?
5356
store.dispatch(AddTodo("2", "World"))
54-
expect(store.getState()).toBe(
57+
expect(store.getState()).asExpect<TestState, Assert<TestState>>().toBe(
5558
TestState(
5659
listOf(
5760
Todo(
@@ -64,7 +67,7 @@ object CreateStoreSpec : Spek({
6467
)
6568
)
6669
)
67-
)
70+
).asAssert()
6871
}
6972

7073
it("applies the reducer to the initial state") {
@@ -78,7 +81,7 @@ object CreateStoreSpec : Spek({
7881
)
7982
)
8083
)
81-
expect(store.getState()).toBe(
84+
expect(store.getState()).asExpect<TestState, Assert<TestState>>().toBe(
8285
TestState(
8386
listOf(
8487
Todo(
@@ -87,10 +90,10 @@ object CreateStoreSpec : Spek({
8790
)
8891
)
8992
)
90-
)
93+
).asAssert()
9194

9295
store.dispatch(Any())
93-
expect(store.getState()).toBe(
96+
expect(store.getState()).asExpect<TestState, Assert<TestState>>().toBe(
9497
TestState(
9598
listOf(
9699
Todo(
@@ -99,10 +102,10 @@ object CreateStoreSpec : Spek({
99102
)
100103
)
101104
)
102-
)
105+
).asAssert()
103106

104107
store.dispatch(AddTodo("2", "World"))
105-
expect(store.getState()).toBe(
108+
expect(store.getState()).asExpect<TestState, Assert<TestState>>().toBe(
106109
TestState(
107110
listOf(
108111
Todo(
@@ -115,7 +118,7 @@ object CreateStoreSpec : Spek({
115118
)
116119
)
117120
)
118-
)
121+
).asAssert()
119122
}
120123

121124
}

0 commit comments

Comments
 (0)