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

tests: refactor MockUrlFetcher to use files #58

Open
nokome opened this issue Nov 22, 2018 · 2 comments
Open

tests: refactor MockUrlFetcher to use files #58

nokome opened this issue Nov 22, 2018 · 2 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@nokome
Copy link
Member

nokome commented Nov 22, 2018

The MockUrlFetcher maps URLs to an Object 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 like http-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.

curl http://crandb.r-pkg.org/gsl > tests/mockUrls/http-crandb.r-pkg.org-gsl.json
@beneboy
Copy link
Contributor

beneboy commented Nov 22, 2018

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.

@nokome
Copy link
Member Author

nokome commented Nov 22, 2018

Thanks @beneboy : would like to get the coverage up #46 before we go much further - this will make that easier.

@nokome nokome added the good first issue Good for newcomers label Nov 22, 2018
@bmpvieira bmpvieira self-assigned this Nov 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants