test-check

grumplet 2018-03-29T22:51:10.000138Z

Is there a reasonably simple way to implement generative tests on an async function? It looks like this might be impossible without reimplementing test.check or clojure.spec.test.alpha/check?

2018-03-29T23:08:28.000242Z

it depends how you do your async functioning

2018-03-29T23:09:22.000323Z

if you just call async functions with abandon, it is hard, if create a an Executor that you can shutdown and run them on that Executor it is pretty easy

2018-03-29T23:12:08.000242Z

basically, if you can put a function like interface on it, it doesn't matter if internally it does stuff asynchronously

2018-03-29T23:21:07.000119Z

For cljs it's impossible

grumplet 2018-03-29T23:22:39.000022Z

@gfredericks That's the conclusion I was coming to 😞

2018-03-29T23:23:38.000014Z

Yeah, it will take some work to add that

2018-03-29T23:23:47.000206Z

Definitely a priority

grumplet 2018-03-29T23:24:03.000152Z

I'm trying to test a remote call to R against a cljs call which should return the same values and was hoping to get test.check style behaviour.

2018-03-29T23:24:25.000133Z

remote call = ajax?

grumplet 2018-03-29T23:24:29.000091Z

yep

2018-03-29T23:26:26.000287Z

A couple heavy workarounds: test from clj, either by rewriting your logic in cljc or shelling out to node

2018-03-29T23:26:39.000243Z

Neither of those are nice obviously

grumplet 2018-03-29T23:27:27.000065Z

Interesting idea though. I suspect the stats model would port to clj without too many problems.

grumplet 2018-03-29T23:28:01.000248Z

Thanks - I'll think about that approach.