graphql-tools icon indicating copy to clipboard operation
graphql-tools copied to clipboard

Can't mock nested field resolvers

Open sunesimonsen opened this issue 3 years ago • 0 comments

Issue workflow progress

Progress of the issue based on the Contributor Workflow

  • [x] 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox

    Make sure to fork this template and run yarn generate in the terminal.

    Please make sure the GraphQL Tools package versions under package.json matches yours.

  • [x] 2. A failing test has been provided
  • [ ] 3. A local solution has been provided
  • [ ] 4. A pull request is pending review

Describe the bug

When mocking a nested root query, I can override any simple field, but overriding resolver fields doesn't work.

To Reproduce

Here is a test showing the problem

You can run the test in my fork, or just copy over the test.

Expected behavior

I expect returnStringArgument to have the value Overridden, but I get the default string value Hello World.

Environment:

  • OS: OSX
  • @graphql-tools/mock:
  • NodeJS: v16.18.0

Additional context

I'm trying to fix a problem we are seeing in another tool graphql-fakester

sunesimonsen avatar Nov 15 '22 08:11 sunesimonsen