diff --git a/spec/cljs/state_spec.cljs b/spec/cljs/state_spec.cljs index 7b5bdbc..dcf63da 100644 --- a/spec/cljs/state_spec.cljs +++ b/spec/cljs/state_spec.cljs @@ -9,12 +9,14 @@ (describe "grub state" (before (reset! state/grubs [])) + (describe "Add grub" (it "should add a grub to the state when an add event comes" (let [test-grub {:_id 12345 :grub "testgrub" :completed true} add-event (assoc test-grub :event :add)] (state/handle-event add-event) (should-contain test-grub @state/grubs)))) + (describe "Create grub" (it "should add a new grub to the state when a create event comes" (let [test-grub {:grub "testgrub"} @@ -27,10 +29,10 @@ (let [test-grub {:grub "testgrub"} create-event (assoc test-grub :event :create)] (state/handle-event create-event) - (log @state/grubs) (let [added-grub (first (filter #(= (:grub %) (:grub test-grub)) @state/grubs))] (should-not-be-nil (:_id added-grub)))))) + (describe "Complete grub" (it "should complete a grub in the state when a complete event comes" (let [test-grub {:_id 234243 :grub "testgrub" :completed false} @@ -40,6 +42,7 @@ (reset! state/grubs [test-grub]) (state/handle-event complete-event) (should-contain expected-grub @state/grubs)))) + (describe "Uncomplete grub" (it "should uncomplete a grub in the state when an uncomplete event comes" (let [test-grub {:_id 234243 :grub "testgrub" :completed true} @@ -49,6 +52,7 @@ (reset! state/grubs [test-grub]) (state/handle-event complete-event) (should-contain expected-grub @state/grubs)))) + (describe "Delete grub" (it "should delete a grub from the state when a delete event comes" (let [test-grub {:_id 234243 :grub "testgrub" :completed true}