Skip to content

Commit 81d32bb

Browse files
committed
update cats.labs.promise-spec tests following Promesa version bump
* change the implemenation of `future-ok` to use `delay`. * remove the unused `future-fail` fn. * remove the `extract-from-rejected-promise` test. It’s not possible to implement this test under the new version of Promesa (as the values returned from `promesa.core/rejected` don’t implement the `-extract` method.) As it’s very unclear what value this test is adding (i.e. it’s not actually testing any required or advertised functionality) it seems safer to just remove it than reimplement it.
1 parent 045a29d commit 81d32bb

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

test/cats/labs/promise_spec.cljc

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,21 @@
44
[cats.context :as ctx :include-macros true]
55
[cats.core :as m :include-macros true]
66
[cats.labs.promise :as pm]
7-
[promesa.core :as p])
7+
[promesa.core :as p]
8+
[promesa.impl :as pi]
9+
[promesa.exec :as pe])
810
:clj (:require [clojure.test :as t]
911
[cats.builtin :as b]
1012
[cats.context :as ctx]
1113
[cats.core :as m]
1214
[cats.labs.promise :as pm]
13-
[promesa.core :as p])))
15+
[promesa.core :as p]
16+
[promesa.exec :as pe])))
1417

1518

1619
(defn future-ok
1720
[sleep value]
18-
(p/promise (fn [resolve reject]
19-
(p/schedule sleep #(resolve value)))))
20-
21-
(defn future-fail
22-
[sleep value]
23-
(p/promise (fn [_ reject]
24-
(p/schedule sleep #(reject value)))))
25-
26-
27-
#?(:cljs
28-
(t/deftest extract-from-rejected-promise
29-
(let [p1 (p/rejected 42)]
30-
(t/is (p/rejected? p1))
31-
(t/is (= (p/extract p1) 42)))))
21+
(p/delay sleep value))
3222

3323
(t/deftest chaining-using-bind
3424
#?(:cljs

0 commit comments

Comments
 (0)