                        (done)))))
      :clj
      (let [value (volatile! nil)
-           c1 (p/schedule 1000 #(vreset! value 1))
-           c2 (p/schedule 1000 #(vreset! value 2))]
+           c1 (p/schedule 500 #(vreset! value 1))
+           c2 (p/schedule 500 #(vreset! value 2))]
        (p/cancel! c1)
-       @(p/schedule 1200 (constantly nil))
+       @(p/schedule 1100 (constantly nil))
        (t/is (realized? c2))
        (t/is (not (realized? c1)))
        (t/is (p/cancelled? c1))

(t/deftest chaining-using-then
  #?(:cljs
     (t/async done
       (let [p1 (future-ok 200 2)
             p2 (p/then p1 inc)
             p3 (p/then p2 inc)]
         (p/then p3 (fn [v]
                      (t/is (= v 4))
                      (done)))))
     :clj
     (let [p1 (future-ok 200 2)
           p2 (p/then p1 inc)
           p3 (p/then p2 inc)]
       (t/is (= @p3 4)))))

(t/deftest chaining-using-chain
  #?(:cljs
     (t/async done
       (let [p1 (future-ok 100 2)
             p2 (p/chain p1 inc inc inc)]
         (p/then p2 (fn [v]
                      (t/is (= v 5))
                      (done)))))
     :clj
     (let [p1 (future-ok 100 2)
           p2 (p/chain p1 inc inc inc)]
       (t/is (= @p2 5)))))

(t/deftest branching-using-branch-1
  #?(:cljs
     (t/async done
       (let [p1 (future-ok 100 2)
             p2 (p/branch p1 #(inc %) (constantly nil))]
         (p/then p2 #(do
                       (t/is (= % 3))
                       (done)))))
     :clj
     (let [p1 (future-ok 100 2)
           p2 (p/branch p1 #(inc %) (constantly nil))]
       (t/is (= @p2 3)))))

