add tests for init! argument changes made earlier
This commit is contained in:
parent
eed182bdd1
commit
5780d6d3a3
|
@ -5,7 +5,9 @@
|
||||||
views.protocols
|
views.protocols
|
||||||
views.core
|
views.core
|
||||||
views.test-view-system)
|
views.test-view-system)
|
||||||
(:import (views.test_view_system MemoryView)))
|
(:import
|
||||||
|
(views.test_view_system MemoryView)
|
||||||
|
(clojure.lang Atom)))
|
||||||
|
|
||||||
(use-fixtures :each reset-test-views-system)
|
(use-fixtures :each reset-test-views-system)
|
||||||
|
|
||||||
|
@ -20,10 +22,11 @@
|
||||||
;; tests
|
;; tests
|
||||||
|
|
||||||
(deftest inits-with-correct-config-and-shutsdown-correctly
|
(deftest inits-with-correct-config-and-shutsdown-correctly
|
||||||
(let [options test-options]
|
(let [options test-options
|
||||||
(is (empty? @test-views-system))
|
; 1. init views
|
||||||
; 1. init views
|
init-returned-atom (init! test-views-system test-options)]
|
||||||
(init! test-views-system test-options)
|
(is (instance? Atom init-returned-atom))
|
||||||
|
(is (= init-returned-atom test-views-system))
|
||||||
(is (seq @test-views-system))
|
(is (seq @test-views-system))
|
||||||
(is (= dummy-send-fn (:send-fn @test-views-system)))
|
(is (= dummy-send-fn (:send-fn @test-views-system)))
|
||||||
(is (and (contains-view? test-views-system :foo)
|
(is (and (contains-view? test-views-system :foo)
|
||||||
|
@ -45,6 +48,18 @@
|
||||||
(doseq [^Thread t workers]
|
(doseq [^Thread t workers]
|
||||||
(is (not (.isAlive t)))))))
|
(is (not (.isAlive t)))))))
|
||||||
|
|
||||||
|
(deftest init-without-existing-view-system-atom
|
||||||
|
(let [options test-options]
|
||||||
|
(let [init-created-atom (init! options)]
|
||||||
|
(is (instance? Atom init-created-atom))
|
||||||
|
(is (seq @init-created-atom))
|
||||||
|
(is (= dummy-send-fn (:send-fn @init-created-atom)))
|
||||||
|
(is (and (contains-view? init-created-atom :foo)
|
||||||
|
(contains-view? init-created-atom :bar)
|
||||||
|
(contains-view? init-created-atom :baz)))
|
||||||
|
(shutdown! init-created-atom)
|
||||||
|
(is (empty? @init-created-atom)))))
|
||||||
|
|
||||||
(deftest init-can-also-start-logger
|
(deftest init-can-also-start-logger
|
||||||
(let [options (-> test-options
|
(let [options (-> test-options
|
||||||
(assoc :stats-log-interval 10000))]
|
(assoc :stats-log-interval 10000))]
|
||||||
|
|
Loading…
Reference in a new issue