ill-logical's avatar

How to test a 'store' function with optional JSON payload?

Hi. How do you test in situations when there are just too many variations to try out?

Imagine you are writing a feature test "user can store a post". Your goal is to test the store method on the controller.

OK, but the payload is large. Some 7 fields are optional - attachments, image gallery, perex text, tags, etc. - these all may or may not be present on submit.

How do you deal with such situations? Split the public method store into many private methods and only unit-test those?

I cannot think of a good approach.

Thank you for your help.

0 likes
0 replies

Please or to participate in this conversation.