summaryrefslogtreecommitdiff
path: root/sw-ui-kt/src/test/kotlin/org/luxons
diff options
context:
space:
mode:
authorjoffrey-bion <joffrey.bion@gmail.com>2019-10-23 00:43:33 +0200
committerjoffrey-bion <joffrey.bion@gmail.com>2019-10-23 00:43:33 +0200
commitffe9dc9fde3b419bd7ac3e105c9c2b2d8b2c0238 (patch)
tree3b8cd4983b85262720014cabe3b643109d5fc3a1 /sw-ui-kt/src/test/kotlin/org/luxons
parentWIP sagas (diff)
downloadseven-wonders-ffe9dc9fde3b419bd7ac3e105c9c2b2d8b2c0238.tar.gz
seven-wonders-ffe9dc9fde3b419bd7ac3e105c9c2b2d8b2c0238.tar.bz2
seven-wonders-ffe9dc9fde3b419bd7ac3e105c9c2b2d8b2c0238.zip
Sagas rework
Diffstat (limited to 'sw-ui-kt/src/test/kotlin/org/luxons')
-rw-r--r--sw-ui-kt/src/test/kotlin/org/luxons/sevenwonders/ui/redux/sagas/SagasFrameworkTest.kt11
1 files changed, 4 insertions, 7 deletions
diff --git a/sw-ui-kt/src/test/kotlin/org/luxons/sevenwonders/ui/redux/sagas/SagasFrameworkTest.kt b/sw-ui-kt/src/test/kotlin/org/luxons/sevenwonders/ui/redux/sagas/SagasFrameworkTest.kt
index d8efcc3a..19489375 100644
--- a/sw-ui-kt/src/test/kotlin/org/luxons/sevenwonders/ui/redux/sagas/SagasFrameworkTest.kt
+++ b/sw-ui-kt/src/test/kotlin/org/luxons/sevenwonders/ui/redux/sagas/SagasFrameworkTest.kt
@@ -47,10 +47,9 @@ class SagaContextTest {
val redux = configureTestStore(State("initial"))
- val saga = saga<State, RAction, WrapperAction> {
+ redux.sagas.runSaga {
dispatch(UpdateData("Bob"))
}
- redux.sagas.runSaga(saga)
assertEquals(State("Bob"), redux.store.getState(), "state is not as expected")
}
@@ -59,16 +58,15 @@ class SagaContextTest {
fun next(): dynamic = GlobalScope.promise {
val redux = configureTestStore(State("initial"))
- val saga = saga<State, RAction, WrapperAction> {
+ val job = redux.sagas.launchSaga(this) {
val action = next<SideEffectAction>()
dispatch(UpdateData("effect-${action.data}"))
}
- redux.sagas.startSaga(saga)
assertEquals(State("initial"), redux.store.getState())
redux.store.dispatch(SideEffectAction("data"))
- delay(50)
+ job.join()
assertEquals(State("effect-data"), redux.store.getState())
}
@@ -77,12 +75,11 @@ class SagaContextTest {
val redux = configureTestStore(State("initial"))
- val saga = saga<State, RAction, WrapperAction> {
+ val job = redux.sagas.launchSaga(this) {
onEach<SideEffectAction> {
dispatch(UpdateData("effect-${it.data}"))
}
}
- val job = redux.sagas.startSaga(saga)
assertEquals(State("initial"), redux.store.getState())
bgstack15