From 98cc6207fde4f0437e638a00693cbb8e6f61ada1 Mon Sep 17 00:00:00 2001 From: Michael Glaesemann Date: Wed, 16 Nov 2016 00:02:56 -0500 Subject: [PATCH] Test Cache ony in cljs environment. Change-Id: I161cc6a20dde9f7dbe7e83574c0c529edcfc9835 --- src/test/om/next/tests.cljc | 39 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/test/om/next/tests.cljc b/src/test/om/next/tests.cljc index b646106e..ad3351a7 100644 --- a/src/test/om/next/tests.cljc +++ b/src/test/om/next/tests.cljc @@ -1057,25 +1057,26 @@ (is (not (contains? (get t-err 'this/throws) :result))) (is (= (get (om/transact! r '[(this/throws) :app/count]) :app/count) 2)))) -(deftest test-cache-clear - (let [r (om/reconciler {:state (atom {:app/count 0}) - :parser p}) - h (get-in r [:config :history])] - (is (= 0 (count @(.-index h)))) - (is (= 0 (count (.-arr h)))) - (om/transact! r '[(app/inc!)]) - (let [h (get-in r [:config :history])] - (is (= 1 (count @(.-index h)))) - (is (= 1 (count (.-arr h))))) - (let [r' (update-in r [:config :history] #(.clear %)) - h' (get-in r' [:config :history])] - (is (= {} @(.-index h'))) - (is (= 0 (count (.-arr h')))) - (is (= [] (js->clj (.-arr h'))))) - (om/transact! r '[(app/inc!)]) - (let [h (get-in r [:config :history])] - (is (= 1 (count @(.-index h)))) - (is (= 1 (count (.-arr h))))))) +#?(:cljs + (deftest test-cache-clear + (let [r (om/reconciler {:state (atom {:app/count 0}) + :parser p}) + h (get-in r [:config :history])] + (is (= 0 (count @(.-index h)))) + (is (= 0 (count (.-arr h)))) + (om/transact! r '[(app/inc!)]) + (let [h (get-in r [:config :history])] + (is (= 1 (count @(.-index h)))) + (is (= 1 (count (.-arr h))))) + (let [r' (update-in r [:config :history] #(.clear %)) + h' (get-in r' [:config :history])] + (is (= {} @(.-index h'))) + (is (= 0 (count (.-arr h')))) + (is (= [] (js->clj (.-arr h'))))) + (om/transact! r '[(app/inc!)]) + (let [h (get-in r [:config :history])] + (is (= 1 (count @(.-index h)))) + (is (= 1 (count (.-arr h)))))))) ;; ----------------------------------------------------------------------------- ;; Recursive Parsing