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

[WIP]: How about this? #93

Open
wants to merge 1 commit into
base: mocks-proposal
Choose a base branch
from
Open

Conversation

diogob
Copy link
Contributor

@diogob diogob commented Jul 1, 2021

If we ask the user to provide a mock for the whole fetch, using typeof fetch the library code gets simpler and we offer a bit more flexibility. We also reduce the possibility of divergence between mock and fetch calls that could originate in the additional code.

options.mockResponse ? mock(options) : fetch(url, config),
)

if (options.mockTimeout) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the mockTimeout use is now orthogonal to the use of mockFetch. So I could introduce a timer on real fetch calls, it could be useful for troubleshooting.

@gustavoguichard gustavoguichard changed the title How about this? [WIP]: How about this? Jul 1, 2021
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.

None yet

1 participant