#65: (mount/start #{}) is a noop

This commit is contained in:
anatoly 2016-11-14 17:25:00 -05:00
parent c56bbfcd40
commit f49fceb518
2 changed files with 14 additions and 4 deletions

View file

@ -244,10 +244,14 @@
(remove (comp :sub? @meta-state) (find-all-states)))
(defn start [& states]
(if (-> states first coll?)
(apply start (first states))
(let [states (or (seq states) (all-without-subs))]
{:started (bring states up <)})))
(let [fs (-> states first)]
(if (coll? fs)
(if-not (empty? fs) ;; (mount/start) vs. (mount/start #{}) vs. (mount/start #{1 2 3})
(apply start fs)
{:started #{}})
(let [states (or (seq states)
(all-without-subs))]
{:started (bring states up <)}))))
(defn stop [& states]
(let [states (or states (find-all-states))

View file

@ -154,4 +154,10 @@
(is (= {:datomic {:uri "datomic:mem://composable-mount"}} (dval config)))
(is (instance? datomic.peer.LocalConnection (dval conn)))
(is (vector? (dval nrepl)))
(mount/stop)))
(testing "should not start anything on empty seq of states"
(let [scope #{}]
(is (= {:started #{}} (-> (only scope)
mount/start)))
(mount/stop)))))