mirror of
https://github.com/status-im/reagent.git
synced 2025-01-14 05:45:06 +00:00
Add test for wrap
This commit is contained in:
parent
f94fcd5542
commit
7244ffc25d
@ -289,3 +289,18 @@
|
|||||||
|
|
||||||
(reset! c3 "foo")
|
(reset! c3 "foo")
|
||||||
(is (= @a {:foo "bar" :foobar "foo"}))))
|
(is (= @a {:foo "bar" :foobar "foo"}))))
|
||||||
|
|
||||||
|
(deftest test-wrap
|
||||||
|
(let [a (atom {:foo "bar"})
|
||||||
|
w (r/wrap (:foo @a) swap! a assoc :foo)]
|
||||||
|
(is (= @w "bar"))
|
||||||
|
(is (= w (r/wrap "bar" swap! a assoc :foo)))
|
||||||
|
(is (not= w (r/wrap "foobar" swap! a assoc :foo)))
|
||||||
|
(is (not= w (r/wrap "bar" swap! a assoc :foobar)))
|
||||||
|
(is (not= w (r/wrap "bar" reset! a assoc :foo)))
|
||||||
|
|
||||||
|
(reset! w "foobar")
|
||||||
|
(is (= @w "foobar"))
|
||||||
|
(is (= @a {:foo "foobar"}))
|
||||||
|
(is (not= w (r/wrap "bar" swap! a assoc :foo)))
|
||||||
|
(is (not= w (r/wrap "foobar" swap! a assoc :foo)))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user