reformat all with linter

This commit is contained in:
anatoly 2018-03-15 23:50:42 -04:00
parent e032a6ef54
commit e247636be6
28 changed files with 70 additions and 70 deletions

View file

@ -5,9 +5,9 @@
(defn load-config [path] (defn load-config [path]
(info "loading config from" path) (info "loading config from" path)
(-> path (-> path
slurp slurp
edn/read-string)) edn/read-string))
(defstate config (defstate config
:start (load-config "dev/resources/config.edn")) :start (load-config "dev/resources/config.edn"))

View file

@ -1,4 +1,4 @@
(ns app.db (ns app.db
(:require [mount.core :refer [defstate]] (:require [mount.core :refer [defstate]]
[datomic.api :as d] [datomic.api :as d]
[clojure.tools.logging :refer [info]] [clojure.tools.logging :refer [info]]
@ -34,7 +34,7 @@
:db/valueType :db.type/bigdec :db/valueType :db.type/bigdec
:db/cardinality :db.cardinality/one :db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db} :db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db] {:db/id #db/id [:db.part/db]
:db/ident :order/qty :db/ident :order/qty
:db/valueType :db.type/long :db/valueType :db.type/long

View file

@ -11,6 +11,6 @@
(defn find-orders [conn ticker] (defn find-orders [conn ticker]
(let [orders (d/q '[:find ?e :in $ ?ticker (let [orders (d/q '[:find ?e :in $ ?ticker
:where [?e :order/symbol ?ticker]] :where [?e :order/symbol ?ticker]]
(d/db conn) ticker)] (d/db conn) ticker)]
(touch conn orders))) (touch conn orders)))

View file

@ -1,4 +1,4 @@
(ns app.utils.logging ;; << change to your namespace/path (ns app.utils.logging ;; << change to your namespace/path
(:require [mount.core] (:require [mount.core]
[robert.hooke :refer [add-hook clear-hooks]] [robert.hooke :refer [add-hook clear-hooks]]
[clojure.string :refer [split]] [clojure.string :refer [split]]
@ -21,9 +21,9 @@
:down "<< stopping" :down "<< stopping"
false)) false))
(defn log-status [f & args] (defn log-status [f & args]
(let [[state-name state] args (let [[state-name state] args
action (f-to-action f state)] action (f-to-action f state)]
(when-let [taking-over-the-world (whatcha-doing? action)] (when-let [taking-over-the-world (whatcha-doing? action)]
(info (str taking-over-the-world ".. " state-name))) (info (str taking-over-the-world ".. " state-name)))
(apply f args))) (apply f args)))

View file

@ -14,10 +14,10 @@
(GET "/nyse/orders/:ticker" [ticker] (GET "/nyse/orders/:ticker" [ticker]
(generate-string (find-orders conn ticker))) (generate-string (find-orders conn ticker)))
(POST "/nyse/orders" [ticker qty bid offer] (POST "/nyse/orders" [ticker qty bid offer]
(let [order {:ticker ticker (let [order {:ticker ticker
:bid (bigdec bid) :bid (bigdec bid)
:offer (bigdec offer) :offer (bigdec offer)
:qty (Integer/parseInt qty)}] :qty (Integer/parseInt qty)}]
(add-order conn order) (add-order conn order)
(generate-string {:added order})))) (generate-string {:added order}))))

View file

@ -13,13 +13,13 @@
(defn find-source-logs [db source] (defn find-source-logs [db source]
(d/q '{:find [?t ?msg] (d/q '{:find [?t ?msg]
:in [$ ?s] :in [$ ?s]
:where [[?e :source ?s] :where [[?e :source ?s]
[?e :timestamp ?t] [?e :timestamp ?t]
[?e :msg ?msg]]} [?e :msg ?msg]]}
@@db source)) @@db source))
(defn find-all-logs [db] (defn find-all-logs [db]
(->> (map :e (d/datoms @@db :aevt :timestamp)) (->> (map :e (d/datoms @@db :aevt :timestamp))
dedupe dedupe
(d/pull-many @@db '[:timestamp :source :msg]))) (d/pull-many @@db '[:timestamp :source :msg])))

View file

@ -12,7 +12,7 @@
" &#8594; [" (name source) "]: " msg)) " &#8594; [" (name source) "]: " msg))
(defn show-log [] (defn show-log []
(.write js/document (.write js/document
(html [:ul (doall (for [e (find-all-logs log)] (html [:ul (doall (for [e (find-all-logs log)]
[:li (format-log-event e)]))]))) [:li (format-log-event e)]))])))

View file

@ -1,4 +1,4 @@
{:datomic {:datomic
{:uri "datomic:mem://mount"} {:uri "datomic:mem://mount"}
:www {:port 4242} :www {:port 4242}

View file

@ -8,7 +8,7 @@
- [Using States](#using-states) - [Using States](#using-states)
- [Thanks](#thanks) - [Thanks](#thanks)
In case you need to manage state in ClojureScript using mount, _all_ the mount Clojure features are supported in ClojureScript. In case you need to manage state in ClojureScript using mount, _all_ the mount Clojure features are supported in ClojureScript.
Which means all the mount Clojure [documentation](../README.md) is the mount ClojureScript documentation. Which means all the mount Clojure [documentation](../README.md) is the mount ClojureScript documentation.
With a slight change in [_mode_](clojurescript.md#mount-modes) ( no change in _mood_ though, just the _mode_ :)). With a slight change in [_mode_](clojurescript.md#mount-modes) ( no change in _mood_ though, just the _mode_ :)).
@ -16,19 +16,19 @@ With a slight change in [_mode_](clojurescript.md#mount-modes) ( no change in _m
### The "Why" ### The "Why"
Since [reader conditionals](http://clojure.org/reader#The%20Reader--Reader%20Conditionals) were added in Clojure 1.7, Since [reader conditionals](http://clojure.org/reader#The%20Reader--Reader%20Conditionals) were added in Clojure 1.7,
it became a lot easier to target both platforms with lots of code reuse. You might have noticed it became a lot easier to target both platforms with lots of code reuse. You might have noticed
that most of mount code lives in `.cljc` files. that most of mount code lives in `.cljc` files.
The way mount is designed it "mounts" itself to a solid Clojure [namespace API](http://clojure.org/namespaces), The way mount is designed it "mounts" itself to a solid Clojure [namespace API](http://clojure.org/namespaces),
and while `.cljc` helps a lot with targeting Clojure and ClojureScript, JavaScript VM is vastly different from JVM. and while `.cljc` helps a lot with targeting Clojure and ClojureScript, JavaScript VM is vastly different from JVM.
Since JavaScript mostly tagrets browsers, mobile devices and IoT, Since JavaScript mostly tagrets browsers, mobile devices and IoT,
it is quite important to [compress](https://github.com/clojure/clojurescript/wiki/Advanced-Compilation) the final result. it is quite important to [compress](https://github.com/clojure/clojurescript/wiki/Advanced-Compilation) the final result.
Which means that Clojure namespaces API are not that well supported in ClojureScript, since they get renamed and optimized Which means that Clojure namespaces API are not that well supported in ClojureScript, since they get renamed and optimized
during compilation + of course no native namespace support on the JavaScript side during compilation + of course no native namespace support on the JavaScript side
(but that is somewhat solved with [Google Closure](https://closure-library.googlecode.com/git-history/docs/local_closure_goog_base.js.source.html#line428)). (but that is somewhat solved with [Google Closure](https://closure-library.googlecode.com/git-history/docs/local_closure_goog_base.js.source.html#line428)).
But. When developing an application in Clojure and ClojureScript, it would only make sense if the API for any library But. When developing an application in Clojure and ClojureScript, it would only make sense if the API for any library
would be _identical_ for both platforms. It should be transparent for developers whether they use a library in Clojure or ClojureScript. would be _identical_ for both platforms. It should be transparent for developers whether they use a library in Clojure or ClojureScript.
It is not possible for all libraries (i.e. concurrency, reified Vars, etc.), but we should try to make it possible for most. It is not possible for all libraries (i.e. concurrency, reified Vars, etc.), but we should try to make it possible for most.
@ -52,7 +52,7 @@ To switch Mount into this mode do:
anywhere before a call to `(mount/start)`, usually at the entry point of an app: in the `-main`, web handler, etc. anywhere before a call to `(mount/start)`, usually at the entry point of an app: in the `-main`, web handler, etc.
This sets mount into the `cljc` mode. In this mode mount supports _both_: Clojure and ClojureScript with one difference This sets mount into the `cljc` mode. In this mode mount supports _both_: Clojure and ClojureScript with one difference
from the default `clj` mode: from the default `clj` mode:
> all states are "_derefable_" > all states are "_derefable_"

View file

@ -7,7 +7,7 @@
:source-paths ["src"] :source-paths ["src"]
:dependencies [] ;; for visual clarity :dependencies [] ;; for visual clarity
:profiles {:dev {:source-paths ["dev" "dev/clj" "test/clj"] :profiles {:dev {:source-paths ["dev" "dev/clj" "test/clj"]
:dependencies [[org.clojure/clojure "1.7.0"] :dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.170"]; :classifier "aot"] [org.clojure/clojurescript "1.7.170"]; :classifier "aot"]

View file

@ -146,7 +146,7 @@
(and (status :started) (and (status :started)
(= :noop on-reload))))) (= :noop on-reload)))))
;;TODO: make private after figuring out the inconsistency betwen cljs compile stages ;;TODO: make private after figuring out the inconsistency betwen cljs compile stages
;; (i.e. _sometimes_ this, if private, is not seen by expanded "defmacro" on cljs side) ;; (i.e. _sometimes_ this, if private, is not seen by expanded "defmacro" on cljs side)
(defn mount-it [s-var s-name s-meta] (defn mount-it [s-var s-name s-meta]
(let [with-inst (assoc s-meta :inst (atom (NotStartedState. s-name)) (let [with-inst (assoc s-meta :inst (atom (NotStartedState. s-name))
@ -160,8 +160,8 @@
(up s-name with-inst (atom #{}))))) (up s-name with-inst (atom #{})))))
#?(:clj #?(:clj
(defmacro defstate (defmacro defstate
"Defines a state. Restarts on recompilation. "Defines a state. Restarts on recompilation.
Pass ^{:on-reload :noop} to prevent auto-restart Pass ^{:on-reload :noop} to prevent auto-restart
on ns recompilation, or :stop to stop on recompilation." on ns recompilation, or :stop to stop on recompilation."
[state & body] [state & body]
@ -309,14 +309,14 @@
(intersection (mapset var-to-str these) (intersection (mapset var-to-str these)
(mapset var-to-str states)))) (mapset var-to-str states))))
(defn with-args (defn with-args
([args] ([args]
(with-args (find-all-states) args)) (with-args (find-all-states) args))
([states args] ([states args]
(reset! -args args) ;; TODO localize (reset! -args args) ;; TODO localize
states)) states))
(defn except (defn except
([states] ([states]
(except (find-all-states) states)) (except (find-all-states) states))
([states these] ([states these]

View file

@ -7,9 +7,9 @@
(defn load-config [path] (defn load-config [path]
(info "loading config from" path) (info "loading config from" path)
(-> path (-> path
slurp slurp
edn/read-string)) edn/read-string))
(defstate config (defstate config
:start (load-config "dev/resources/config.edn")) :start (load-config "dev/resources/config.edn"))

View file

@ -30,7 +30,7 @@
:db/valueType :db.type/bigdec :db/valueType :db.type/bigdec
:db/cardinality :db.cardinality/one :db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db} :db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db] {:db/id #db/id [:db.part/db]
:db/ident :order/qty :db/ident :order/qty
:db/valueType :db.type/long :db/valueType :db.type/long
@ -51,11 +51,11 @@
:order/bid bid :order/bid bid
:order/offer offer :order/offer offer
:order/qty qty}])) :order/qty qty}]))
(defn find-orders [ticker] ;; can take connection as param (defn find-orders [ticker] ;; can take connection as param
(let [orders (d/q '[:find ?e :in $ ?ticker (let [orders (d/q '[:find ?e :in $ ?ticker
:where [?e :order/symbol ?ticker]] :where [?e :order/symbol ?ticker]]
(d/db @nyse/conn) ticker)] (d/db @nyse/conn) ticker)]
(touch @nyse/conn orders))) (touch @nyse/conn orders)))

View file

@ -1,4 +1,4 @@
(ns tapp.utils.logging ;; << change to your namespace/path (ns tapp.utils.logging ;; << change to your namespace/path
(:require [mount.core] (:require [mount.core]
[robert.hooke :refer [add-hook clear-hooks]] [robert.hooke :refer [add-hook clear-hooks]]
[clojure.string :refer [split]] [clojure.string :refer [split]]
@ -21,9 +21,9 @@
:down "<< stopping" :down "<< stopping"
false)) false))
(defn log-status [f & args] (defn log-status [f & args]
(let [[state-name state] args (let [[state-name state] args
action (f-to-action f state)] action (f-to-action f state)]
(when-let [taking-over-the-world (whatcha-doing? action)] (when-let [taking-over-the-world (whatcha-doing? action)]
(info (str taking-over-the-world ".. " state-name))) (info (str taking-over-the-world ".. " state-name)))
(apply f args))) (apply f args)))

View file

@ -13,13 +13,13 @@
(defn find-source-logs [db source] (defn find-source-logs [db source]
(d/q '{:find [?t ?msg] (d/q '{:find [?t ?msg]
:in [$ ?s] :in [$ ?s]
:where [[?e :source ?s] :where [[?e :source ?s]
[?e :timestamp ?t] [?e :timestamp ?t]
[?e :msg ?msg]]} [?e :msg ?msg]]}
@@db source)) @@db source))
(defn find-all-logs [db] (defn find-all-logs [db]
(->> (map :e (d/datoms @@db :aevt :timestamp)) (->> (map :e (d/datoms @@db :aevt :timestamp))
dedupe dedupe
(d/pull-many @@db '[:timestamp :source :msg]))) (d/pull-many @@db '[:timestamp :source :msg])))

View file

@ -12,7 +12,7 @@
" &#8594; [" (name source) "]: " msg)) " &#8594; [" (name source) "]: " msg))
(defn show-log [] (defn show-log []
(.write js/document (.write js/document
(html [:ul (doall (for [e (find-all-logs log)] (html [:ul (doall (for [e (find-all-logs log)]
[:li (format-log-event e)]))]))) [:li (format-log-event e)]))])))

View file

@ -11,7 +11,7 @@
[mount.test.helper :refer [dval helper forty-two]])) [mount.test.helper :refer [dval helper forty-two]]))
(def status (atom :a-not-started)) (def status (atom :a-not-started))
(defstate a :start (reset! status :a-started) (defstate a :start (reset! status :a-started)
:stop (reset! status :a-stopped)) :stop (reset! status :a-stopped))
#?(:clj (alter-meta! *ns* assoc ::load false)) #?(:clj (alter-meta! *ns* assoc ::load false))
@ -30,11 +30,11 @@
(testing "should cleanup/stop a state after it was deleted from ns" (testing "should cleanup/stop a state after it was deleted from ns"
(is (empty? (:started (mount/start)))) ;; on any mount op (not necessarily on "stop") (is (empty? (:started (mount/start)))) ;; on any mount op (not necessarily on "stop")
(is (= :a-stopped @status)) (is (= :a-stopped @status))
(is (not (some #{"#'mount.test.cleanup-deleted-states/a"} (is (not (some #{"#'mount.test.cleanup-deleted-states/a"}
(keys @@#'mount.core/meta-state))))) (keys @@#'mount.core/meta-state)))))
(testing "should not stop it again on stop (should not be there by this point)") (testing "should not stop it again on stop (should not be there by this point)")
(is (not (some #{"#'mount.test.cleanup-deleted-states/a"} (is (not (some #{"#'mount.test.cleanup-deleted-states/a"}
(-> (mount/stop) :stopped set)))))) (-> (mount/stop) :stopped set))))))
;; (t/run-tests) ;; (t/run-tests)

View file

@ -48,7 +48,7 @@
(.require js/goog "mount.test.helper") ;; should have run :stop of `helper` (.require js/goog "mount.test.helper") ;; should have run :stop of `helper`
;; (is (= :cleaned @forty-two)) ;; TODO: figure out how to reload a namespace properly ;; (is (= :cleaned @forty-two)) ;; TODO: figure out how to reload a namespace properly
;; (is (instance? mount.core.NotStartedState (dval helper))) ;; (is (instance? mount.core.NotStartedState (dval helper)))
(mount/start #'mount.test.helper/helper) (mount/start #'mount.test.helper/helper)
(is (= :started (dval helper))) (is (= :started (dval helper)))
(mount/stop) (mount/stop)
(is (instance? mount.core.NotStartedState (dval helper)))))) (is (instance? mount.core.NotStartedState (dval helper))))))

View file

@ -31,14 +31,14 @@
#?(:clj #?(:clj
(deftest only-states (deftest only-states
(testing "only should only return given states. (testing "only should only return given states.
if source set of states is not provided, it should use all the states to select from" if source set of states is not provided, it should use all the states to select from"
(is (= #{"#'mount.test.composable-fns/test-conn" "#'tapp.example/nrepl" "#'tapp.nyse/conn"} (is (= #{"#'mount.test.composable-fns/test-conn" "#'tapp.example/nrepl" "#'tapp.nyse/conn"}
(only #{"#'is.not/here" #'mount.test.composable-fns/test-conn #'tapp.example/nrepl #'tapp.nyse/conn})))) (only #{"#'is.not/here" #'mount.test.composable-fns/test-conn #'tapp.example/nrepl #'tapp.nyse/conn}))))
(testing "only should only return given states" (testing "only should only return given states"
(is (= #{"#'mount.test.composable-fns/test-conn" "#'tapp.example/nrepl"} (is (= #{"#'mount.test.composable-fns/test-conn" "#'tapp.example/nrepl"}
(only [#'mount.test.composable-fns/test-conn #'tapp.example/nrepl #'tapp.nyse/conn] (only [#'mount.test.composable-fns/test-conn #'tapp.example/nrepl #'tapp.nyse/conn]
#{"#'is.not/here" #'mount.test.composable-fns/test-conn #'tapp.example/nrepl})))))) #{"#'is.not/here" #'mount.test.composable-fns/test-conn #'tapp.example/nrepl}))))))
#?(:clj #?(:clj

View file

@ -43,7 +43,7 @@
#'mount.test.fun-with-values/private-f #'mount.test.fun-with-values/private-f
#'mount.test.fun-with-values/f-value)) #'mount.test.fun-with-values/f-value))
(use-fixtures :once (use-fixtures :once
#?(:cljs {:before start-states #?(:cljs {:before start-states
:after mount/stop} :after mount/stop}
:clj #((start-states) (%) (mount/stop)))) :clj #((start-states) (%) (mount/stop))))

View file

@ -5,10 +5,10 @@
#?(:clj (alter-meta! *ns* assoc ::load false)) #?(:clj (alter-meta! *ns* assoc ::load false))
(defn dval (defn dval
"returns a value of DerefableState without deref'ing it" "returns a value of DerefableState without deref'ing it"
[d] [d]
(-> (@@(var mount.core/meta-state) (-> (@@(var mount.core/meta-state)
#?(:clj (.name d) #?(:clj (.name d)
:cljs (.-name d))) :cljs (.-name d)))
:inst :inst

View file

@ -7,7 +7,7 @@
[tapp.audit-log :refer [log]]] [tapp.audit-log :refer [log]]]
:clj [[clojure.test :as t :refer [is are deftest testing use-fixtures]] :clj [[clojure.test :as t :refer [is are deftest testing use-fixtures]]
[mount.core :as mount :refer [defstate]] [mount.core :as mount :refer [defstate]]
[tapp.example]]) [tapp.example]])
[mount.test.helper :refer [dval helper forty-two counter inc-counter]] [mount.test.helper :refer [dval helper forty-two counter inc-counter]]
[mount.test.on-reload-helper :refer [a b c]])) [mount.test.on-reload-helper :refer [a b c]]))
@ -42,14 +42,14 @@
;; "b" is marked as :stop on reload ;; "b" is marked as :stop on reload
(is (instance? mount.core.NotStartedState (dval b))) (is (instance? mount.core.NotStartedState (dval b)))
(is (= (-> pre-reload :b :started) (is (= (-> pre-reload :b :started)
(-> @counter :b :started))) (-> @counter :b :started)))
(is (= (inc (-> pre-reload :b :stopped)) (is (= (inc (-> pre-reload :b :stopped))
(-> @counter :b :stopped))) (-> @counter :b :stopped)))
;; "c" is not marked on reload, using "restart" as default ;; "c" is not marked on reload, using "restart" as default
(is (= :started (dval c))) (is (= :started (dval c)))
(is (= (inc (-> pre-reload :c :started)) (is (= (inc (-> pre-reload :c :started))
(-> @counter :c :started))) (-> @counter :c :started)))
(is (= (inc (-> pre-reload :c :stopped)) (is (= (inc (-> pre-reload :c :stopped))
(-> @counter :c :stopped)))))) (-> @counter :c :stopped))))))

View file

@ -20,18 +20,18 @@
(f) (f)
(mount/stop))) (mount/stop)))
(use-fixtures :once (use-fixtures :once
#?(:cljs {:before #(mount/start #'tapp.conf/config #'tapp.audit-log/log) #?(:cljs {:before #(mount/start #'tapp.conf/config #'tapp.audit-log/log)
:after mount/stop} :after mount/stop}
:clj with-parts)) :clj with-parts))
#?(:clj #?(:clj
(deftest start-only-parts (deftest start-only-parts
(is (instance? datomic.peer.LocalConnection (dval conn))) (is (instance? datomic.peer.LocalConnection (dval conn)))
(is (instance? mount.core.NotStartedState (dval should-not-start))))) (is (instance? mount.core.NotStartedState (dval should-not-start)))))
#?(:cljs #?(:cljs
(deftest start-only-parts (deftest start-only-parts
(is (instance? datascript.db/DB @(dval log))) (is (instance? datascript.db/DB @(dval log)))
(is (map? (dval config))) (is (map? (dval config)))
(is (instance? mount.core.NotStartedState (dval should-not-start))) (is (instance? mount.core.NotStartedState (dval should-not-start)))

View file

@ -9,11 +9,11 @@
#?(:clj (alter-meta! *ns* assoc ::load false)) #?(:clj (alter-meta! *ns* assoc ::load false))
(use-fixtures :once (use-fixtures :once
#?(:cljs {:before #(mount/start #'mount.test.fun-with-values/private-f) #?(:cljs {:before #(mount/start #'mount.test.fun-with-values/private-f)
:after mount/stop} :after mount/stop}
:clj #((mount/start #'mount.test.fun-with-values/private-f) :clj #((mount/start #'mount.test.fun-with-values/private-f)
(%) (%)
(mount/stop)))) (mount/stop))))
(deftest fun-with-values (deftest fun-with-values

View file

@ -51,7 +51,7 @@
(is (instance? mount.core.NotStartedState (dval test-conn))) (is (instance? mount.core.NotStartedState (dval test-conn)))
(is (instance? mount.core.NotStartedState (dval test-nrepl))) (is (instance? mount.core.NotStartedState (dval test-nrepl)))
(mount/stop))))) (mount/stop)))))
#?(:clj #?(:clj
(deftest start-with (deftest start-with
@ -62,7 +62,7 @@
(is (= :nrepl-sub (dval nrepl))) (is (= :nrepl-sub (dval nrepl)))
(is (= "conn-sub" (dval conn))) (is (= "conn-sub" (dval conn)))
(mount/stop))) (mount/stop)))
(testing "should start normally after start-with" (testing "should start normally after start-with"
(let [_ (mount/start)] (let [_ (mount/start)]
(is (map? (dval config))) (is (map? (dval config)))

View file

@ -67,7 +67,7 @@
(is (instance? mount.core.NotStartedState (dval test-conn))) (is (instance? mount.core.NotStartedState (dval test-conn)))
(is (instance? mount.core.NotStartedState (dval test-nrepl))) (is (instance? mount.core.NotStartedState (dval test-nrepl)))
(mount/stop))))) (mount/stop)))))
#?(:clj #?(:clj
(deftest start-with-states (deftest start-with-states
@ -78,7 +78,7 @@
(is (instance? clojure.tools.nrepl.server.Server (dval nrepl))) (is (instance? clojure.tools.nrepl.server.Server (dval nrepl)))
(is (= (dval conn) 42)) (is (= (dval conn) 42))
(mount/stop))) (mount/stop)))
#_(testing "should not start the substitute itself" ;; was true when subbing with exsiting states #_(testing "should not start the substitute itself" ;; was true when subbing with exsiting states
(let [_ (mount/start-with-states {#'tapp.nyse/conn swap-conn})] (let [_ (mount/start-with-states {#'tapp.nyse/conn swap-conn})]
(is (instance? mount.core.NotStartedState (dval test-conn))) (is (instance? mount.core.NotStartedState (dval test-conn)))

View file

@ -20,7 +20,7 @@
(f) (f)
(mount/stop))) (mount/stop)))
(use-fixtures :once (use-fixtures :once
#?(:cljs {:before #(mount/start-without #'mount.test.helper/helper #'tapp.websockets/system-a) #?(:cljs {:before #(mount/start-without #'mount.test.helper/helper #'tapp.websockets/system-a)
:after mount/stop} :after mount/stop}
:clj without)) :clj without))

View file

@ -25,7 +25,7 @@
(is (instance? mount.core.NotStartedState (dval config))) (is (instance? mount.core.NotStartedState (dval config)))
(is (instance? mount.core.NotStartedState (dval system-a))) (is (instance? mount.core.NotStartedState (dval system-a)))
(mount/stop))) (mount/stop)))
(testing "should start normally after stop-except" (testing "should start normally after stop-except"
(let [_ (mount/start)] (let [_ (mount/start)]
(is (map? (dval config))) (is (map? (dval config)))
@ -51,7 +51,7 @@
(is (instance? datomic.peer.LocalConnection (dval conn))) (is (instance? datomic.peer.LocalConnection (dval conn)))
(is (instance? mount.core.NotStartedState (dval nrepl))) (is (instance? mount.core.NotStartedState (dval nrepl)))
(mount/stop))) (mount/stop)))
(testing "should start normally after stop-except" (testing "should start normally after stop-except"
(let [_ (mount/start)] (let [_ (mount/start)]
(is (map? (dval config))) (is (map? (dval config)))