|
1057 | 1057 | (is (not (contains? (get t-err 'this/throws) :result))) |
1058 | 1058 | (is (= (get (om/transact! r '[(this/throws) :app/count]) :app/count) 2)))) |
1059 | 1059 |
|
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)))))))) |
1079 | 1080 |
|
1080 | 1081 | ;; ----------------------------------------------------------------------------- |
1081 | 1082 | ;; Recursive Parsing |
|
0 commit comments