Skip to content

tests: refactor MockUrlFetcher to use files #58

@nokome

Description

@nokome

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions