0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 07:29:08 -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))
(defn run-store
[store done events completed-cb]
(let [stream (ptk/input-stream store)]
(->> stream
(rx/take-until (rx/filter #(= :the/end %) stream))
(rx/last)
(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 events]
(ptk/emit! store event)))
(ptk/emit! store :the/end)))
([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)]
(->> stream
(rx/take-until (if stopper
(stopper stream)
(rx/filter #(= :the/end %) stream)))
(rx/last)
(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 events]
(ptk/emit! store event)))
(ptk/emit! store :the/end))))
(defn get-file-from-store
[store]