-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby-source-filesystem): add optional name parameter to createRemoteFileNode #11054
Conversation
Thank you for this, @oorestisime Would you like to also add a test or two to assert this behaviour and ensure we don't see a regression again? 🙂 |
I would really like to do so but for this particular package it is always hard, at least for me. There are a lot of mocks to do and basically i am not sure how do to do so (plus there are not many in place to get inspired). If you have an example in mind i can work on it probably. |
@oorestisime So in In this you would pass in a Check out the documentation at https://jestjs.io/docs/en/mock-functions for how to listen on arguments a mock fn is called with |
But until now these tests were not entering here https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-filesystem/src/create-remote-file-node.js#L180-L262 and there i need to mock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sidharthachatterjee it's fairly challenging to test this in a clean way. We can mock--but we need to mock quite a bit, and then those test(s) will likely become a little fragile and will require a fair amount of tweaking when we make changes to this functionality.
It would be excellent if we can perhaps refactor this a bit to enable easier unit testing (and cleaner code!), but I don't think that should be a blocker to merging this PR. That being said--subequent PRs addressing some of the things we're talking about here would be 👌
Thanks to both of you!
|
…RemoteFileNode (gatsbyjs#11054) Fix: gatsbyjs#11037 <!-- Have any questions? Check out the contributing docs at https://gatsby.app/contribute, or ask in this Pull Request and a Gatsby maintainer will be happy to help :) --> ## Description Take an optional name parameter to fix issue with temporary urls having no "guessable" name <!-- Write a brief description of the changes introduced by this PR --> ## Related Issues <!-- Link to the issue that is fixed by this PR (if there is one) e.g. Fixes gatsbyjs#1234, Addresses gatsbyjs#1234, Related to gatsbyjs#1234, etc. -->
Fix: #11037
Description
Take an optional name parameter to fix issue with temporary urls having no "guessable" name
Related Issues