graphql-tools
graphql-tools copied to clipboard
[batch-delegate] Error paths use their batched indices
Description
Reproduction test case. When using an n-plus-one delegateToSchema, the result is as expected. When using batchDelegateToSchema, error paths are incorrect.
We expect the path to have index 1 as the error is for the second object, however it is the same error as at index 0 and is deduplicated in the batched request. The error returned has this deduplicated index instead of its actual index.
FAIL packages/batch-delegate/tests/errorPaths.test.ts
● preserves error path indices › using batchDelegateToSchema
expect(received).toMatchObject(expected)
- Expected - 1
+ Received + 1
@@ -28,11 +28,11 @@
"id": "1",
},
"message": "Not Found",
"path": Array [
"objects",
- 1,
+ 0,
"property",
],
},
],
}
149 |
150 | expect(getProperty).toBeCalledTimes(1);
> 151 | expect(result).toMatchObject(expected);
| ^
152 | });
153 | });
154 |
at Object.<anonymous> (packages/batch-delegate/tests/errorPaths.test.ts:151:20)
Related #2950
Type of change
Please delete options that are not relevant.
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
Screenshots/Sandbox (if appropriate/relevant):
Adding links to sandbox or providing screenshots can help us understand more about this PR and take action on it as appropriate
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- [ ] Test A
- [ ] Test B
Test Environment:
- OS:
@graphql-tools/...:- NodeJS:
Checklist:
- [ ] I have followed the CONTRIBUTING doc and the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests and linter rules pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...
⚠️ No Changeset found
Latest commit: d99f20b88653d98f9dcda3fbbb3b63b815b7941e
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/theguild/graphql-tools/GeNL2PjXdSzn3dCqiZb2QZwSyn9J
✅ Preview: https://graphql-tools-git-fork-mjbcopland-issue-2950-er-459c9c-theguild.vercel.app