Fork me on GitHub
#core-async
<
2018-10-18
>
Logan Powell13:10:18

👋 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?

markmarkmark14:10:51

@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

markmarkmark14:10:47

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.

Logan Powell14:10:50

Thank you @markmarkmark Should I incorporate the latch function as well

markmarkmark14:10:47

probably not a bad idea if that's what they use

markmarkmark14:10:46

what is that test you pasted above doing? what do you want it to do?

Logan Powell14:10:26

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.

Logan Powell15:10:43

I can't get it to work 😞

Logan Powell15:10:58

it always gives me :ok

Logan Powell15:10:17

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

markmarkmark15:10:11

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 😞

Logan Powell15:10:32

It's cool. I appreciate your eyes man. I'll just move on for now

markmarkmark15:10:57

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.

Logan Powell15:10:09

good idea, will do