From 327ba927670052db3147a158cbaea3a0c3630836 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Tue, 1 Nov 2022 09:15:23 +0000 Subject: [PATCH] port ReducerTest to exported module fixtures --- domains/state/build.gradle | 6 ++++++ .../state/src/testFixtures/kotlin/fake}/FakeEventSource.kt | 2 +- .../state/src/testFixtures/kotlin/test}/ReducerTest.kt | 3 ++- features/directory/build.gradle | 1 + .../kotlin/app/dapk/st/directory/DirectoryReducerTest.kt | 1 + 5 files changed, 11 insertions(+), 2 deletions(-) rename {features/directory/src/test/kotlin/app/dapk/st/directory => domains/state/src/testFixtures/kotlin/fake}/FakeEventSource.kt (92%) rename {features/directory/src/test/kotlin/app/dapk/st/directory => domains/state/src/testFixtures/kotlin/test}/ReducerTest.kt (98%) diff --git a/domains/state/build.gradle b/domains/state/build.gradle index c8609bb..9db4d7f 100644 --- a/domains/state/build.gradle +++ b/domains/state/build.gradle @@ -5,4 +5,10 @@ plugins { dependencies { implementation Dependencies.mavenCentral.kotlinCoroutinesCore + + testFixturesImplementation testFixtures(project(":core")) + testFixturesImplementation Dependencies.mavenCentral.kotlinCoroutinesCore + testFixturesImplementation Dependencies.mavenCentral.kluent + testFixturesImplementation Dependencies.mavenCentral.mockk + testFixturesImplementation Dependencies.mavenCentral.kotlinCoroutinesTest } \ No newline at end of file diff --git a/features/directory/src/test/kotlin/app/dapk/st/directory/FakeEventSource.kt b/domains/state/src/testFixtures/kotlin/fake/FakeEventSource.kt similarity index 92% rename from features/directory/src/test/kotlin/app/dapk/st/directory/FakeEventSource.kt rename to domains/state/src/testFixtures/kotlin/fake/FakeEventSource.kt index d94097b..9a2d816 100644 --- a/features/directory/src/test/kotlin/app/dapk/st/directory/FakeEventSource.kt +++ b/domains/state/src/testFixtures/kotlin/fake/FakeEventSource.kt @@ -1,4 +1,4 @@ -package app.dapk.st.directory +package fake import org.amshove.kluent.internal.assertEquals diff --git a/features/directory/src/test/kotlin/app/dapk/st/directory/ReducerTest.kt b/domains/state/src/testFixtures/kotlin/test/ReducerTest.kt similarity index 98% rename from features/directory/src/test/kotlin/app/dapk/st/directory/ReducerTest.kt rename to domains/state/src/testFixtures/kotlin/test/ReducerTest.kt index af53ed5..a8acc00 100644 --- a/features/directory/src/test/kotlin/app/dapk/st/directory/ReducerTest.kt +++ b/domains/state/src/testFixtures/kotlin/test/ReducerTest.kt @@ -1,9 +1,10 @@ -package app.dapk.st.directory +package test import app.dapk.state.Action import app.dapk.state.Reducer import app.dapk.state.ReducerFactory import app.dapk.state.ReducerScope +import fake.FakeEventSource import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest diff --git a/features/directory/build.gradle b/features/directory/build.gradle index 6c6583a..d1d22ef 100644 --- a/features/directory/build.gradle +++ b/features/directory/build.gradle @@ -14,6 +14,7 @@ dependencies { androidImportFixturesWorkaround(project, project(":matrix:common")) androidImportFixturesWorkaround(project, project(":core")) + androidImportFixturesWorkaround(project, project(":domains:state")) androidImportFixturesWorkaround(project, project(":domains:store")) androidImportFixturesWorkaround(project, project(":domains:android:viewmodel")) androidImportFixturesWorkaround(project, project(":domains:android:stub")) diff --git a/features/directory/src/test/kotlin/app/dapk/st/directory/DirectoryReducerTest.kt b/features/directory/src/test/kotlin/app/dapk/st/directory/DirectoryReducerTest.kt index 98d96fc..d801076 100644 --- a/features/directory/src/test/kotlin/app/dapk/st/directory/DirectoryReducerTest.kt +++ b/features/directory/src/test/kotlin/app/dapk/st/directory/DirectoryReducerTest.kt @@ -10,6 +10,7 @@ import io.mockk.mockk import kotlinx.coroutines.flow.flowOf import org.junit.Test import test.expect +import test.testReducer private val AN_OVERVIEW = aRoomOverview() private val AN_OVERVIEW_STATE = DirectoryItem(AN_OVERVIEW, UnreadCount(1), null)