You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is one of the two related issues that led me to submit #83 (the other is #88).
calls, called, lastCall, lastUrl. lastOptions are all documented as taking a matcher argument. This argument can only meaningfully be a string naming an existing route, and thus it differs subtly from the meaning of matcher in what's probably the most visible API, mock():
matcher [required]: Condition for selecting which requests to mock Accepts any of the following
* string: ...
* RegExp: ...
* Function(url, opts): ...
Here is a case where my (incorrect) reading of the docs led to surprising behavior:
fetchMock.mock('^http://example.com/');fetch('http://example.com/one/two').then(()=>{fetchMock.called('^http://example.com/');// truefetchMock.called('^http://example.com/one');// false (surprising to me)fetchMock.called(/one\/two$/);// false (surprising to me)});
The text was updated successfully, but these errors were encountered:
This is one of the two related issues that led me to submit #83 (the other is #88).
calls
,called
,lastCall
,lastUrl
.lastOptions
are all documented as taking amatcher
argument. This argument can only meaningfully be astring
naming an existing route, and thus it differs subtly from the meaning ofmatcher
in what's probably the most visible API,mock()
:Here is a case where my (incorrect) reading of the docs led to surprising behavior:
The text was updated successfully, but these errors were encountered: