Skip to content

Commit

Permalink
tests: fix async test
Browse files Browse the repository at this point in the history
  • Loading branch information
armed committed Mar 27, 2024
1 parent 2bd8d24 commit 91eedfc
Showing 1 changed file with 21 additions and 26 deletions.
47 changes: 21 additions & 26 deletions test/k16/gx/beta/async_processor_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

(def ^:export my-component-timeout
{:gx/start {:gx/processor (fn [{:keys [props]}]
@(p/delay 10000)
props)
(p/do (p/delay 10000) props))
:gx/timeout 10}})

#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
Expand All @@ -36,18 +35,12 @@

(defn- run-check [s]
(is (= {:foo :bar}
#?(:clj (-> (gx/failures s)
:my-component
:causes
first
:exception
(ex-data))
:cljs (-> (gx/failures s)
:my-component
:causes
first
:exception
(ex-data))))))
(-> (gx/failures s)
:my-component
:causes
first
:exception
(ex-data)))))

#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(deftest async-rejected-component-test
Expand All @@ -66,15 +59,17 @@
(test-async (gx/signal {:graph graph} :gx/start) run-check)))

#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(deftest async-timeout-component-test
(let [graph {:my-component
{:gx/component
'k16.gx.beta.async-processor-test/my-component-timeout
:gx/props {:foo :bar}}}]
(is (= "Operation timed out."
(-> @(gx/signal {:graph graph} :gx/start)
(gx/failures)
:my-component
:causes
first
:title)))))
#?(:clj
(deftest async-timeout-component-test
(let [graph {:my-component
{:gx/component
'k16.gx.beta.async-processor-test/my-component-timeout
:gx/props {:foo :bar}}}]
(is (= "Operation timed out."
(-> @(gx/signal {:graph graph} :gx/start)
(gx/failures)
:my-component
:causes
first
:title))))))

0 comments on commit 91eedfc

Please sign in to comment.