       (is (nil? @sub))))
 
   (testing "an asynchronous scheduler updates state asynchronously"
-    (let [async-delay 50 ;; in ms
+    (let [async-delay 50                                    ;; in ms
           r (citrus/reconciler {:state           (atom {:test :initial-state})
                                 :controllers     {:test test-controller}
                                 :batched-updates {:schedule-fn (fn [f] (js/setTimeout f async-delay)) :release-fn (fn [id] (js/clearTimeout id))}})

                                            (done)))))

  (testing "dispatch! an non-existing event fails"
    (let [err-handler (fn [err]
                        (is (re-find #"No method .* for dispatch value: :non-existing-dispatch" (.toString err))))]
      (obj/set js/window "onerror" err-handler)
      (citrus/dispatch! r :test :non-existing-dispatch)
      (async done (js/requestAnimationFrame (fn []
                                                (obj/set js/window "onerror" nil)
                                                (done)))))))


(deftest broadcast!


  (testing "broadcast-sync! a non-existing event fails"
    (is (thrown-with-msg? js/Error
                          #"Assert failed: Controller :test doesn't declare :non-existing-event method"
                          (citrus/broadcast-sync! r :non-existing-event)))))


