Skip to content

Commit 98cc620

Browse files
committed
Test Cache ony in cljs environment.
Change-Id: I161cc6a20dde9f7dbe7e83574c0c529edcfc9835
1 parent 5e1af73 commit 98cc620

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

src/test/om/next/tests.cljc

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,25 +1057,26 @@
10571057
(is (not (contains? (get t-err 'this/throws) :result)))
10581058
(is (= (get (om/transact! r '[(this/throws) :app/count]) :app/count) 2))))
10591059

1060-
(deftest test-cache-clear
1061-
(let [r (om/reconciler {:state (atom {:app/count 0})
1062-
:parser p})
1063-
h (get-in r [:config :history])]
1064-
(is (= 0 (count @(.-index h))))
1065-
(is (= 0 (count (.-arr h))))
1066-
(om/transact! r '[(app/inc!)])
1067-
(let [h (get-in r [:config :history])]
1068-
(is (= 1 (count @(.-index h))))
1069-
(is (= 1 (count (.-arr h)))))
1070-
(let [r' (update-in r [:config :history] #(.clear %))
1071-
h' (get-in r' [:config :history])]
1072-
(is (= {} @(.-index h')))
1073-
(is (= 0 (count (.-arr h'))))
1074-
(is (= [] (js->clj (.-arr h')))))
1075-
(om/transact! r '[(app/inc!)])
1076-
(let [h (get-in r [:config :history])]
1077-
(is (= 1 (count @(.-index h))))
1078-
(is (= 1 (count (.-arr h)))))))
1060+
#?(:cljs
1061+
(deftest test-cache-clear
1062+
(let [r (om/reconciler {:state (atom {:app/count 0})
1063+
:parser p})
1064+
h (get-in r [:config :history])]
1065+
(is (= 0 (count @(.-index h))))
1066+
(is (= 0 (count (.-arr h))))
1067+
(om/transact! r '[(app/inc!)])
1068+
(let [h (get-in r [:config :history])]
1069+
(is (= 1 (count @(.-index h))))
1070+
(is (= 1 (count (.-arr h)))))
1071+
(let [r' (update-in r [:config :history] #(.clear %))
1072+
h' (get-in r' [:config :history])]
1073+
(is (= {} @(.-index h')))
1074+
(is (= 0 (count (.-arr h'))))
1075+
(is (= [] (js->clj (.-arr h')))))
1076+
(om/transact! r '[(app/inc!)])
1077+
(let [h (get-in r [:config :history])]
1078+
(is (= 1 (count @(.-index h))))
1079+
(is (= 1 (count (.-arr h))))))))
10791080

10801081
;; -----------------------------------------------------------------------------
10811082
;; Recursive Parsing

0 commit comments

Comments
 (0)