0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-03 04:49:03 -05:00

Add new signature for the run-store test helper

This commit is contained in:
alonso.torres 2024-07-03 15:22:42 +02:00
parent 9125b46ca5
commit 80e17f8cfc

View file

@ -39,21 +39,25 @@
store)) store))
(defn run-store (defn run-store
[store done events completed-cb] ([store done events completed-cb]
(let [stream (ptk/input-stream store)] (run-store store done events completed-cb nil))
(->> stream ([store done events completed-cb stopper]
(rx/take-until (rx/filter #(= :the/end %) stream)) (let [stream (ptk/input-stream store)]
(rx/last) (->> stream
(rx/tap (fn [] (rx/take-until (if stopper
(completed-cb @store))) (stopper stream)
(rx/subs! (fn [_] (done)) (rx/filter #(= :the/end %) stream)))
(fn [cause] (rx/last)
(js/console.log "[error]:" cause)) (rx/tap (fn []
(fn [_] (completed-cb @store)))
(js/console.log "[complete]")))) (rx/subs! (fn [_] (done))
(doall (for [event events] (fn [cause]
(ptk/emit! store event))) (js/console.log "[error]:" cause))
(ptk/emit! store :the/end))) (fn [_]
(js/console.log "[complete]"))))
(doall (for [event events]
(ptk/emit! store event)))
(ptk/emit! store :the/end))))
(defn get-file-from-store (defn get-file-from-store
[store] [store]