This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-18
Channels
- # 100-days-of-code (6)
- # announcements (4)
- # beginners (126)
- # cider (49)
- # cljdoc (28)
- # cljsrn (3)
- # clojure (89)
- # clojure-dev (19)
- # clojure-greece (2)
- # clojure-italy (13)
- # clojure-mexico (1)
- # clojure-nl (13)
- # clojure-spec (108)
- # clojure-sweden (1)
- # clojure-uk (48)
- # clojurescript (31)
- # cloverage (3)
- # core-async (16)
- # cursive (28)
- # data-science (3)
- # datascript (1)
- # datomic (60)
- # defnpodcast (1)
- # docker (17)
- # editors (18)
- # emacs (16)
- # events (1)
- # figwheel (22)
- # figwheel-main (4)
- # graphql (26)
- # jobs (2)
- # off-topic (9)
- # om-next (2)
- # overtone (4)
- # perun (1)
- # re-frame (2)
- # reagent (18)
- # reitit (1)
- # ring-swagger (2)
- # shadow-cljs (2)
- # tools-deps (49)
- # uncomplicate (1)
- # unrepl (1)
- # vim (2)
👋 Hi everyone, I've tried a number of different things to get testing going with core.async, but no bueno... any tips for something like this?
@loganpowell if you need examples of testing core async things, there's probably no better source than https://github.com/clojure/core.async/tree/master/src/test
I haven't looked at them super closely, but a quick glance at them makes it look like an oft used pattern for their tests is to put the expected output into a promise and wait on deref'ing the promise.
Thank you @markmarkmark Should I incorporate the latch
function as well
probably not a bad idea if that's what they use
what is that test you pasted above doing? what do you want it to do?
I'm trying to test that async-fn
which takes an input chan
and output chan
. Takes the args from the input, calls an external API, does some internal data manipulation and puts the result into the output.
I can't get it to work 😞
it always gives me :ok
I don't see how this works: https://github.com/clojure/core.async/blob/master/src/test/cljs/cljs/core/async/tests.cljs#L148 and my code doesn't
also, it seems that the latch
function is a way to tell a test that has multiple async functions that they've all completed, i.e., not necessary for testing a single process
Unfortunately, I don't know much about Clojurescript. I'm not even sure how to set up a similar environment to try things out with you 😞
It's cool. I appreciate your eyes man. I'll just move on for now
that code you pasted up there looks like it should work to me as well. It might be worth asking in #clojurescript since there will be more people there that understand testing in cljs in general.
good idea, will do