NorfairKing / validity

Validity and validity-based testing
https://www.youtube.com/watch?v=eIs9qNh17SM
MIT License
156 stars 31 forks source link

Aeson tests should support golden round trip tests #94

Closed dustin closed 2 years ago

dustin commented 2 years ago

I'd like something similar to hspec-golden-aeson allowing GenValidity to create a sufficient consistent set of values that can be serialized and tested against in a golden test.

Right now, one must think of all of the ways to build an object (including transitive values) and write tests for all the combinations. It'd be great to do this automatically.

NorfairKing commented 2 years ago

We can do this, but you're not going to like the result. Arbitrary data is not what you want to be using in this case, you want fake data instead.

dustin commented 2 years ago

Understood. I've used hspec-golden-aeson and the output is not super pleasant. It's not a replacement for having known hand-written bits, but it's better than trying to imagine all possibilities and having embedded objects change unexpectedly.

NorfairKing commented 2 years ago

You might want to make a similar issue in the fake-data repo instead.

NorfairKing commented 2 years ago

sydtest-aeson does what you want, I think.