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
If each entry in the array is an object, this can result in unpredictable results as all the values of the objects will also be auto-filled. It would be really useful to be able to manually configure the mock store to return arrays of length 0.
When calling addMocksToSchema an argument could be provided.
The alternative is to manually provide a mock of [] for all queries you wish to be consistent, but this takes away much of the value of leaving the auto-mocking to handle most of the load.
I am happy to work on this issue but want to gauge interest.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Arrays produce unpredictable results when a mock is not explicitly provided.
Describe the solution you'd like
When arrays are not explicitly given a mock they will default to a length of 2 according to the return value of randomListLength. See
graphql-tools/packages/mock/src/MockStore.ts
Line 493 in 99319be
If each entry in the array is an object, this can result in unpredictable results as all the values of the objects will also be auto-filled. It would be really useful to be able to manually configure the mock store to return arrays of length 0.
When calling
addMocksToSchema
an argument could be provided.addMocksToSchema({ schema, defaultListLength: 0 })
Describe alternatives you've considered
The alternative is to manually provide a mock of
[]
for all queries you wish to be consistent, but this takes away much of the value of leaving the auto-mocking to handle most of the load.I am happy to work on this issue but want to gauge interest.
The text was updated successfully, but these errors were encountered: