Closed leandro closed 5 years ago
The short answer is no, there isn't a preferred or recommended way of doing this. I've worked on different projects that have all done it different ways - each having pros and cons. I've seen some attempts at validating JSON API responses in different elixir projects, but never come across something that I've really loved. I agree it's burdensome and would love to find a solution to this.
@beerlington I see. Thanks nonetheless for your candid response. I guess I'll simple assert against the first item of the collection and maybe the size of it too. That will suffice for now. I believe you now close this issue.
Hi. I'm currently missing some documentation on the recommended way of testing controller actions, where I actually need to check the JSON response in a more automated way (without having to assert the JSON response against a manually typed/paste arbitrary structure).
I'm asking for some light on this because it's burdensome when it comes about checking the JSON response of
index
actions (for instance), where it normally outputs a collection in JSON-API format. And if usingPhoenixView
module, it's not clear to me what's a good way to test the response. Is there any?