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.
I propose an API that applies a matcher (string|RegExp|function(url, opts)) to the whole list of calls, regardless of any configured routes or their names. I consider this behavior useful in composing assertions that aren't possible with calls(routeName) or called(routeName), such as:
// Assuming a new method: fetchMock.testCallsfetchMock.mock('^http://example.com/');fetch('http://example.com/?arg1=123').then(()=>{// called() would return false for each of the followingfetchMock.testCalls('http://example.com/?arg1=123');// truefetchMock.testCalls('^http://example.com/?arg1=');// truefetchMock.testCalls(/arg1=\d+$/);// true});
So basically, it would do what I had the impression called() and calls()should do, as described in #87. #83 contains a proposed implementation in the form of callsMatching() and calledMatching()filterCalls() and testCalls().
The text was updated successfully, but these errors were encountered:
I don't particularly want to have two supported ways of checking for matched calls - that will add to the complexity of the api, and thus increase confusion when it's being used. So if your suggestion was adopted I see it being a major release
Could clearer and more distinct naming (e.g. filterCalls(), testCalls() as in the updated PR #83) help reduce confusion despite the larger API surface?
I've decided to close this - it's been a long time with no supporting comments. Thanks fro submitting though, and for highlighting the confusing nature of the docs
This is one of the two related issues that led me to submit #83.
I propose an API that applies a
matcher
(string|RegExp|function(url, opts)
) to the whole list of calls, regardless of any configured routes or their names. I consider this behavior useful in composing assertions that aren't possible withcalls(routeName)
orcalled(routeName)
, such as:So basically, it would do what I had the impression
called()
andcalls()
should do, as described in #87.#83 contains a proposed implementation in the form of
callsMatching()
andcalledMatching()
filterCalls()
andtestCalls()
.The text was updated successfully, but these errors were encountered: