Skip to content

Copy Symbols as well in copyOwnPropsIfNotPresent#4505

Merged
ardatan merged 2 commits intoardatan:masterfrom
Hetch3t:copy-symbols-as-well-during-mocking
Sep 24, 2025
Merged

Copy Symbols as well in copyOwnPropsIfNotPresent#4505
ardatan merged 2 commits intoardatan:masterfrom
Hetch3t:copy-symbols-as-well-during-mocking

Conversation

@Hetch3t
Copy link
Contributor

@Hetch3t Hetch3t commented Jun 4, 2022

Hi!

I had issues with mocking lib - we use ObjectId from Mongo as an ID scalar type, so after introducing mocking to our schema it started to fail. After hefty amount of time debugging it turned out that ObjectId is implemented in such a way that is is stored as buffer as Symbol(id). Function that is being used in @graphql-tools/mock uses Object.getOwnPropertyNames which doesn't list Symbols. The solution I've implemented you can see in this PR.

@changeset-bot
Copy link

changeset-bot bot commented Jun 4, 2022

🦋 Changeset detected

Latest commit: c0a70fd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphql-tools/mock Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jun 4, 2022

@Hetch3t is attempting to deploy a commit to the The Guild Team on Vercel.

A member of the Team first needs to authorize it.

@ardatan
Copy link
Owner

ardatan commented Jun 5, 2022

Thanks for the PR! Would you add some unit tests to prevent future regressions and changeset(using yarn changeset)?

@ardatan ardatan force-pushed the master branch 2 times, most recently from 4946aeb to 4be9073 Compare July 20, 2022 20:01
@theguild-bot theguild-bot mentioned this pull request Apr 23, 2023
@theguild-bot theguild-bot mentioned this pull request Oct 26, 2023
@bkalbs
Copy link

bkalbs commented Nov 28, 2023

We just encountered this same issue when attempting to mock the MongoID scalar type (started getting error "Cannot create Buffer from undefined"), which led me to this PR. I quick/dirty tested the proposed changes here and they seem to work wonderfully🥇!

Other than needing tests, is there anything else that is blocking this fix from making it into a release? At over a year old, is this PR still valid? I see that it's listed in the project roadmap, but just wanted to give it a bump.

@Urigo
Copy link
Collaborator

Urigo commented Dec 2, 2023

@bkalbs-wm would you be able to contribute a test for this?

@bkalbs
Copy link

bkalbs commented Dec 6, 2023

@Urigo i can give it a go once I get some breathing room from this work deadline i am on. would like to help however i can. I can open up a new PR once ready.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 24, 2025

Warning

Rate limit exceeded

@ardatan has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 2 minutes and 23 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between fded91e and c0a70fd.

📒 Files selected for processing (3)
  • .changeset/chubby-spoons-fly.md (1 hunks)
  • packages/mock/src/utils.ts (1 hunks)
  • packages/mock/tests/addMocksToSchema.spec.ts (2 hunks)
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ardatan ardatan force-pushed the copy-symbols-as-well-during-mocking branch from 6017864 to c0a70fd Compare September 24, 2025 16:44
@ardatan
Copy link
Owner

ardatan commented Sep 24, 2025

I added a test and a changeset! Thanks for the PR!

@ardatan ardatan merged commit f26bc08 into ardatan:master Sep 24, 2025
14 checks passed
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

Successfully merging this pull request may close these issues.

4 participants