From d8621974c26287d2e1ddb579b0c6cabdaec763c5 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Wed, 7 Aug 2024 17:14:05 +0200 Subject: [PATCH] Update with upstream --- frontend/test/token_tests/helpers/state.cljs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/test/token_tests/helpers/state.cljs b/frontend/test/token_tests/helpers/state.cljs index 22c656ea3..283c3125f 100644 --- a/frontend/test/token_tests/helpers/state.cljs +++ b/frontend/test/token_tests/helpers/state.cljs @@ -48,21 +48,22 @@ ([store done events completed-cb] (run-store store done events completed-cb nil)) ([store done events completed-cb stopper] - (let [stream (ptk/input-stream store)] + (let [stream (ptk/input-stream store) + stopper-s (if (fn? stopper) + (stopper stream) + (rx/filter #(= :the/end %) stream))] (->> stream - (rx/take-until (if stopper - (stopper stream) - (rx/filter #(= :the/end %) stream))) + (rx/take-until stopper-s) (rx/last) - (rx/tap (fn [] + (rx/tap (fn [_] (completed-cb @store))) (rx/subs! (fn [_] (done)) (fn [cause] (js/console.log "[error]:" cause)) (fn [_] #_(js/console.log "[complete]")))) - (doall (for [event (concat events [(end+)])] - (ptk/emit! store event))) + (doseq [event (concat events [(end+)])] + (ptk/emit! store event)) (ptk/emit! store :the/end)))) (defn run-store-async