diff --git a/src/temporal/promise.clj b/src/temporal/promise.clj index a553601..42d6a60 100644 --- a/src/temporal/promise.clj +++ b/src/temporal/promise.clj @@ -77,9 +77,9 @@ promises returned from [[temporal.activity/invoke]] from within workflow context (defn resolved "Returns a new, fully resolved promise" [value] - (Workflow/newPromise value)) + (pt/->PromiseAdapter (Workflow/newPromise value))) (defn rejected "Returns a new, rejected promise" [^Exception e] - (Workflow/newFailedPromise e)) + (pt/->PromiseAdapter (Workflow/newFailedPromise e))) diff --git a/test/temporal/test/resolved_promises.clj b/test/temporal/test/resolved_promises.clj new file mode 100644 index 0000000..c6186d6 --- /dev/null +++ b/test/temporal/test/resolved_promises.clj @@ -0,0 +1,24 @@ +;; Copyright © Manetu, Inc. All rights reserved + +(ns temporal.test.resolved-promises + (:require [clojure.test :refer :all] + [taoensso.timbre :as log] + [temporal.client.core :as c] + [temporal.workflow :refer [defworkflow]] + [temporal.promise :as pt] + [temporal.test.utils :as t])) + +(use-fixtures :once t/wrap-service) + +(defworkflow all-workflow + [args] + (log/info "workflow:" args) + @(pt/all [(pt/resolved true)]) + @(pt/race [(pt/resolved true)]) + :ok) + +(deftest the-test + (testing "Verifies that pt/resolved and pt/rejected are compatible with all/race" + (let [workflow (t/create-workflow all-workflow)] + (c/start workflow {}) + (is (-> workflow c/get-result deref (= :ok))))))