Fork me on GitHub
#test-check
<
2019-05-08
>
ben11:05:00

I have a really basic question: If I want to test multiple assertions in a property test, what is the most idiomatic way to do it? Is it just to wrap each assertion in an all? Or can I leave them as separate forms?

ben11:05:33

I suppose I could wrap each in a clojure.test/is but that seems definitely wrong

gfredericks11:05:36

@ben606 are you using defspec?

gfredericks12:05:28

the main two options are 1) Multiple defspecs 2) an and inside a single defspec

gfredericks12:05:38

there's tradeoffs

gfredericks12:05:55

the and could be made nicer if somebody wrote a version of and that returned result-data about which branch failed

ben12:05:59

Okay, thanks @gfredericks. I guess this isn’t good practice, but I am testing things that depend on each other (db write and read). Seems like the Right Way would be to use multiple defspecs with some additonal setup/teardown?

gfredericks22:05:23

@ben606 if you're doing something like "generate data, write it to the db, read it back, check that it's equivalent", then you'd want to do all of that in one defspec