Handy when you want to keep tests synchronous.
this is only a partial impl atm. There's this pure js one if you need more
Fake the sources of your js/Promises (e.g. http calls) to return sync promises
(require '[com.widdindustries.synchronous-promise :as sp])
(-> (sp/resolved :val)
(.then (fn [v] [v]))
(.catch (fn [_] (throw (js/Error. "never called"))))
(.then (fn [x] (js/console.log x) x)))
; make it work with promesa fns
(promesa.impl/extend-promise! sp/SyncPromise)
(set! promesa.impl/*default-promise* sp/SyncPromise)
see the test nss for more examples
Copyright © 2020 Widd Industries Ltd
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close