                              (t/is (p/rejected? p1))
                              (done))))))
 
+(t/deftest reject-promise-in-chain
+  (t/async done
+    (let [p1 (p/promise 1)
+          p2 (p/then p1 (fn [v]
+                          (throw (ex-info "foobar" {:msg "foo"}))))
+          p3 (p/catch p2 (fn [e]
+                           (:msg (ex-data e))))]
+      (p/then p3 (fn [v]
+                   (t/is (= v "foo"))
+                   (done))))))
+
+
 (t/deftest promise-as-functor
   (t/async done
     (let [rp (m/fmap inc (p/promise 2))]

                   (t/is (= v 3))
                   (done))))))

(t/deftest promisify
  (t/async done
    (let [func1 (fn [x cb] (cb (inc x)))

        p2 (p/promise p1)]
    (t/is (identical? p1 p2))))

(t/deftest syncrhonize-two-promises
  (let [p1 (-> (p/all [(p/promise 1) (p/promise 2)])
               (p/then (fn [[x y]]
                         (t/is (= x 1))
