Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Nek-12 committed Jan 3, 2024
1 parent e49c2fb commit a76626c
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ internal data class ConsumerScopeImpl<S : MVIState, in I : MVIIntent, out A : MV
@PublishedApi
internal val state: MutableState<S> = mutableStateOf(store.state)

override fun intent(intent: I) = store.send(intent)
override fun intent(intent: I) = store.intent(intent)
override suspend fun emit(intent: I) = store.emit(intent)

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class NativeStore<S : MVIState, I : MVIIntent, A : MVIAction>(
/**
* See [pro.respawn.flowmvi.api.IntentReceiver.send]
*/
public fun send(intent: I): Unit = store.send(intent)
public fun send(intent: I): Unit = store.intent(intent)

/**
* See [pro.respawn.flowmvi.api.IntentReceiver.send]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class ActionShareBehaviorTest : FreeSpec({
}
idle()
val intent = TestIntent { action(TestAction.Some) }
send(intent)
intent(intent)
joinAll(job1, job2)
plugin.intents shouldContain intent
plugin.actions shouldContain TestAction.Some
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class StoreEventsTest : FreeSpec({
val store = testStore(plugin)
"then intents result in actions" {
store.subscribeAndTest {
send { send(TestAction.Some) }
intent { action(TestAction.Some) }
actions.test {
awaitItem() shouldBe TestAction.Some
}
Expand Down Expand Up @@ -71,7 +71,7 @@ class StoreEventsTest : FreeSpec({
store.subscribeAndTest {
states.test {
awaitItem() shouldBe TestState.Some
send { }
intent { }
awaitItem() shouldBe newState
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class StoreExceptionsText : FreeSpec({

"then exceptions in processing scope do not cancel the pipeline" {
store.test { job ->
send { }
intent { }
idle()
job.isActive shouldBe true
plugin.intents.shouldBeSingleton()
Expand Down Expand Up @@ -86,7 +86,7 @@ class StoreExceptionsText : FreeSpec({
recover { null }
}
store.test { job ->
send {
intent {
launch a@{
println("job 1 started")
[email protected] b@{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import kotlinx.coroutines.cancelAndJoin
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.supervisorScope
import kotlinx.coroutines.withTimeout
import pro.respawn.flowmvi.dsl.intent
import pro.respawn.flowmvi.dsl.send
import pro.respawn.flowmvi.test.subscribeAndTest
import pro.respawn.flowmvi.test.test
Expand Down Expand Up @@ -62,7 +63,7 @@ class StoreLaunchTest : FreeSpec({
"then if launched can process intents" {
coroutineScope {
store.subscribeAndTest {
send { }
intent { }
idle()
plugin.intents.shouldBeSingleton()
}
Expand All @@ -87,7 +88,7 @@ class StoreLaunchTest : FreeSpec({
val intent = TestIntent { throw IllegalArgumentException("intent was handled") }
"and if store is launched and closed" - {
store.test {
send { println("intent") }
intent { println("intent") }
idle()
}
idle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import kotlinx.coroutines.awaitCancellation
import kotlinx.coroutines.launch
import pro.respawn.flowmvi.api.DelicateStoreApi
import pro.respawn.flowmvi.dsl.LambdaIntent
import pro.respawn.flowmvi.dsl.intent
import pro.respawn.flowmvi.dsl.send
import pro.respawn.flowmvi.plugins.timeTravelPlugin
import pro.respawn.flowmvi.test.subscribeAndTest
Expand Down Expand Up @@ -37,7 +38,7 @@ class StoreStatesTest : FreeSpec({
"then state is never updated by another intent" {
store.subscribeAndTest {
send(blockingIntent)
send {
intent {
updateState {
TestState.SomeData(1)
}
Expand All @@ -52,7 +53,7 @@ class StoreStatesTest : FreeSpec({
"then withState is never executed" {
store.subscribeAndTest {
send(blockingIntent)
send {
intent {
withState {
throw AssertionError("WithState was executed")
}
Expand All @@ -69,8 +70,8 @@ class StoreStatesTest : FreeSpec({
store.subscribeAndTest {
states.test {
awaitItem() shouldBe TestState.Some
send(blockingIntent)
send { useState { newState } }
intent(blockingIntent)
intent { useState { newState } }
awaitItem() shouldBe newState
state shouldBe newState
}
Expand Down
1 change: 1 addition & 0 deletions savedstate/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies {
commonMainApi(libs.kotlin.serialization.json)
commonMainImplementation(libs.kotlin.atomicfu)
commonMainImplementation(libs.kotlin.io)
commonMainCompileOnly(projects.annotations)

androidMainApi(libs.lifecycle.savedstate)
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ public class StoreTestScope<S : MVIState, I : MVIIntent, A : MVIAction> @Publish

@OptIn(DelicateStoreApi::class)
override val state: S by store::state
override fun send(intent: I): Unit = store.send(intent)
override suspend fun emit(intent: I): Unit = store.send(intent)
override fun intent(intent: I): Unit = store.send(intent)
override suspend fun emit(intent: I): Unit = store.emit(intent)
override fun intent(intent: I): Unit = store.intent(intent)

/**
* Assert that [Provider.state] is equal to [state]
Expand Down

0 comments on commit a76626c

Please sign in to comment.