Fix state tests

This commit is contained in:
Nicholas Kariniemi 2013-08-24 19:24:29 +03:00
parent 71806ee7e3
commit 0cc95f0829

View file

@ -24,7 +24,8 @@
(it "should complete a grub in the state when a complete event comes"
(let [test-grub {:_id 234243 :grub "testgrub" :completed false}
expected-grub (assoc test-grub :completed true)
complete-event (-> (select-keys [:_id])
complete-event (-> test-grub
(select-keys [:_id])
(assoc :event :complete))]
(reset! state/grubs [test-grub])
(state/handle-event complete-event)
@ -34,7 +35,8 @@
(it "should uncomplete a grub in the state when an uncomplete event comes"
(let [test-grub {:_id 234243 :grub "testgrub" :completed true}
expected-grub (assoc test-grub :completed false)
complete-event (-> (select-keys [:_id])
complete-event (-> test-grub
(select-keys [:_id])
(assoc :event :uncomplete))]
(reset! state/grubs [test-grub])
(state/handle-event complete-event)
@ -60,7 +62,7 @@
(it "should generate an _id for the new grub"
(let [test-grub {:grub "testgrub"}
create-event (assoc test-grub :event :create)]
(state/handle-event create-event)
(state/handle-view-event create-event)
(js/setTimeout (fn []
(let [added-grub (first (filter #(= (:grub %) (:grub test-grub))
@state/grubs))]