ardatan / ardatan/graphql-tools
Gain access to input variables from mock functions
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 830
- Avg merge
- 10h 59m
- Merged PRs (30d)
- 45
Description
**Is your feature request related to a problem? Please describe.**
During testing, I need to make sure certain requests are being called with specific variables, similar to how you'd assert functions were called with certain arguments.
**Describe the solution you'd like**
Pass the input variables of the operation to the mocked function, only if it's a mock for an operation (mutation/query), not just any field.
**Describe alternatives you've considered**
I tried using resolvers, which seem to be getting the input variables through the info parameter, but resolvers have to supply all the fields for a given operation, whereas I want to supply only partial fields and let the rest of the fields be populated using the current mocking strategy.
Contributor guide
Research direction
Start by tracing the mock-function handling for GraphQL operations, focusing on how query and mutation mocks receive inputs. Verify that operation variables reach those mocks while field mocks retain the existing partial-field behavior, and add or update coverage for asserting variables passed to a mocked operation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100