Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MockStore find and filter fail if no items have ever been added for the type #6262

Open
4 tasks done
snstanton opened this issue Jun 13, 2024 · 0 comments
Open
4 tasks done

Comments

@snstanton
Copy link

snstanton commented Jun 13, 2024

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

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

    see the test cases

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

Describe the bug

If the store does not have an entry for typeName yet, then filter() or find() of the type raises:
TypeError: Cannot convert undefined or null to object

To Reproduce Steps to reproduce the behavior:

Create a MockStore with no entries. Call store.filter('foo', x => true) and see the exception

Expected behavior

It should return an empty array instead of raising an exception.

Environment:

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

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant