-
Notifications
You must be signed in to change notification settings - Fork 12
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
tests: refactor MockUrlFetcher to use files #58
Labels
good first issue
Good for newcomers
Comments
This is a good idea. I did this for the NPM information but in the interest of getting the tests fixed quickly I reverted to the if-statement approach. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
MockUrlFetcher
maps URLs to anObject
representing the expected JSON response.Currently, adding a new URL requires adding a new method/if statement to the code. Instead, we could have a folder called
tests/mockUrls
with files likehttp-crandb.r-pkg.org-gsl.json
with the expected JSON content.MockUrlFetcher
would then just look for a file matching the URL and return a 404 if no match was found. That would make it easier to add/update the expected JSON as we add new fixtured e.g.The text was updated successfully, but these errors were encountered: