Open jwoertink opened 10 months ago
Thinking about this more... Maybe we can just do deep nested checks? For example, I want to know if the response has a key with a value that's a massive object, but I only need to verify that one of the key/values in that massive object exist...
# {user: {username: "...", slug: "...", created_at: ..., updated_at: ...., preferences: {theme: "dark", size: "large"}}}
response.should send_json(200, user: {username: "...", preferences: {theme: "dark"}})
This would then let me just do a quick few spot checks on an object instead of trying to worry about the exact time on created_at, or building out each object in a sub array and so on.
I don't know exactly what this looks like yet, but I have a ton of really large custom JSON output in my actions that are too complex to say
response.should send_json(200, messages: [{.......}])
. Really I don't care that the value looks exactly a specific way, I just want to ensure that there is a value from that key. So really I want something kind of like..or maybe comparing a type somehow?
definitely a half-baked idea :joy:
https://github.com/luckyframework/lucky/blob/8eef897212ebbcbb6f0735ae3d8c3381f44b2449/src/lucky/request_expectations.cr#L12