Add a test to cover the newly discovered nil case

This commit is contained in:
Mike Thompson 2016-08-09 00:01:15 +10:00
parent 656f586ece
commit 5c17176f8d
1 changed files with 14 additions and 0 deletions

View File

@ -45,6 +45,20 @@
(is (= (get-effect a :db) ;; test after
{:1 {:2 :4}})))))
(deftest test-path-with-nil-db
(let [db {:1 {:2 :target}}
p (path [:1 :2])] ;; a two level path
(let [b4 (-> (context [] [] db)
((:before p))) ;; before
a (-> b4
(assoc-effect :db nil) ;; <-- db becomes nil
((:after p)))] ;; after
(is (= (get-coeffect b4 :db)) ;; test before
:target)
(is (= (get-effect a :db) ;; test after
{:1 {:2 nil}})))))
(deftest test-db-handler-interceptor
(let [event [:a :b]