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

Fix errors in find and filter with an empty store

Open snstanton opened this issue 1 year ago • 2 comments

🚨 IMPORTANT: Please do not create a Pull Request without creating an issue first.

Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.

Description

In MockStore, this change guards against an empty store in calls to filter/find to avoid calling Object.values() on undefined.

Related #6262

Type of change

Please delete options that are not relevant.

  • [x] Bug fix (non-breaking change which fixes an issue)

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

  • [x] store.spec.ts:filter method
  • [x] store.spec.ts:find method

Test Environment:

  • OS: macos
  • @graphql-tools/mock: 9.0.3
  • NodeJS: v22.2.0

Checklist:

  • [x] I have followed the CONTRIBUTING doc and the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] New and existing unit tests and linter rules pass locally with my changes
  • [x] Any dependent changes have been merged and published in downstream modules

Further comments

None

snstanton avatar Jun 13 '24 20:06 snstanton