You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a high level umbrella issue for issues related to testing utilities.
There are currently 2 main ways to obtain Operation.Data instances for testing:
calling the data class constructor directly.
capturing a JSON and then parsing it into Operation.Data instances.
Solution 1. is cumbersome because there are a lot of parameters to pass. Also in polymorphic cases, we add __typename automatically and figuring out what __typename to pass in the constructor can be confusing.
Solution 2. is cumbersome because editing JSON isn't fun. There's no autocomple/IDE support and the JSON are quite large. Also, if for some reason, the JSON shape isn't the expected one, parsing will just fail.
Also, none of these solutions allow automatically faking field values. Every field must be explicitely provided.
Data Builders attempt to fix those issues by providing a DSL to create fake Operation.Data instances. They suffer from some limitations though:
This is a high level umbrella issue for issues related to testing utilities.
There are currently 2 main ways to obtain
Operation.Data
instances for testing:Operation.Data
instances.Solution 1. is cumbersome because there are a lot of parameters to pass. Also in polymorphic cases, we add
__typename
automatically and figuring out what__typename
to pass in the constructor can be confusing.Solution 2. is cumbersome because editing JSON isn't fun. There's no autocomple/IDE support and the JSON are quite large. Also, if for some reason, the JSON shape isn't the expected one, parsing will just fail.
Also, none of these solutions allow automatically faking field values. Every field must be explicitely provided.
Data Builders
attempt to fix those issues by providing a DSL to create fakeOperation.Data
instances. They suffer from some limitations though:FakeResolver
API isn't the most flexible when it comes to faking values in cental place (Have a way to specify a global customFakeResolver
for data builders #4435)Now that we have execution algorithms, we could use them to provide a "true" schema based testing experience. This is also what the web client is doing at the moment, see https://www.youtube.com/watch?v=TCp3P5gAacA
Linked issues:
FakeResolver
for data builders #4435The text was updated successfully, but these errors were encountered: