 
 (def connect-url "ws://localhost:8000/timers/ws-connect/")
 
+(defn- try-take!!
+  [channel]
+  (alt!!
+    channel              ([value] value)
+    (async/timeout 1000) (throw (ex-info "Take from channel timed out" {:channel channel}))))
+
+(defn- try-deref
+  [a-promise]
+  (let [result (deref a-promise 1000 ::deref-timeout)]
+    (if (= result ::deref-timeout)
+      (throw (ex-info "Deref promise timed out" {:promise a-promise}))
+      result)))
 
 (deftest start-timer-command
   (let [gen-projects  (projects.helpers/populate-data! {"gid1" ["foo"]

                              :duration     {:hours   0
                                             :minutes 0
                                             :seconds 37}}))
        (let [command-response (<!! response-chan)]
          (is (:error command-response))))

      (finally (ws/close socket)))))

                             {:command      "start-timer"
                              :timer-id     (:id timer2)
                              :started-time current-time}))
        (let [command-response (try-take!! response-chan)]
          (is (:error command-response))))

      (finally (ws/close socket)))))
