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
Is your feature request related to a problem? Please describe.
When mocking a field that is an array of a given type, I can mock that type, but if I want to have a list that is consistent then it's a ton of work to write a mock for that type.
If MockList passed the index of the array it is currently building it would be easier to create a list where a certain set of values is populated for each index consistently.
Same issue for a normal mock that is used in a list field.
Describe the solution you'd like
for MockList: pass the value of i to this.wrappedFunction() in https://github.com/ardatan/graphql-tools/blob/master/packages/mock/src/MockList.ts#L53;
for regular mocks: for a List type mock, pass the index of the current item in the list to the mock resolver
Describe alternatives you've considered
Implementing mocks that contain their own auto-incrementing count.
Is your feature request related to a problem? Please describe.
When mocking a field that is an array of a given type, I can mock that type, but if I want to have a list that is consistent then it's a ton of work to write a mock for that type.
If
MockList
passed the index of the array it is currently building it would be easier to create a list where a certain set of values is populated for each index consistently.Same issue for a normal mock that is used in a list field.
Describe the solution you'd like
MockList
: pass the value ofi
tothis.wrappedFunction()
inhttps://github.com/ardatan/graphql-tools/blob/master/packages/mock/src/MockList.ts#L53
;Describe alternatives you've considered
Implementing mocks that contain their own auto-incrementing count.
Additional context
example of the idea here
The text was updated successfully, but these errors were encountered: