This repository has been archived by the owner on Feb 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Allow intercepting only specified requests #64
Comments
ianwsperber
added a commit
to ianwsperber/yesno
that referenced
this issue
Mar 28, 2020
ianwsperber
added a commit
to ianwsperber/yesno
that referenced
this issue
Mar 28, 2020
Merged
ianwsperber
added a commit
to ianwsperber/yesno
that referenced
this issue
Mar 29, 2020
ianwsperber
added a commit
to ianwsperber/yesno
that referenced
this issue
Mar 29, 2020
ianwsperber
added a commit
to ianwsperber/yesno
that referenced
this issue
Mar 29, 2020
ianwsperber
added a commit
to ianwsperber/yesno
that referenced
this issue
Mar 29, 2020
ianwsperber
added a commit
to ianwsperber/yesno
that referenced
this issue
Mar 29, 2020
ianwsperber
added a commit
to ianwsperber/yesno
that referenced
this issue
Mar 29, 2020
ianwsperber
added a commit
to ianwsperber/yesno
that referenced
this issue
Mar 29, 2020
ianwsperber
added a commit
to ianwsperber/yesno
that referenced
this issue
Mar 29, 2020
ianwsperber
added a commit
to ianwsperber/yesno
that referenced
this issue
Mar 29, 2020
ianwsperber
added a commit
to ianwsperber/yesno
that referenced
this issue
Apr 29, 2020
ianwsperber
added a commit
to ianwsperber/yesno
that referenced
this issue
Apr 29, 2020
ianwsperber
added a commit
to ianwsperber/yesno
that referenced
this issue
Apr 29, 2020
@ianwsperber was this issue addressed with #66 or is there still something that needs to be done? Can you explain the remaining tasks if there are any? |
keithcom
pushed a commit
that referenced
this issue
Jun 15, 2020
keithcom
added a commit
that referenced
this issue
Jun 15, 2020
document the matching respond functionality #64
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
As a developer, I would like to be able to intercept only specified network requests.
Today YesNo takes an "all or nothing" approach to HTTP interception. Such an approach works well in a context where all outbound HTTP requests are deterministic and bounded. However if the numbers of requests is unknown or the requests may occur in an unknown order, this approach breaks down when we attempt to use mocks. Consider the below example:
In this test, all we care is that at least 1 request was made to formidable. This works fine when spying on requests. However when running against mocks, the test will fail if the requests made by
getUsers
do not not match the mocks, which could happen either because:There are 2 solutions I'm considering for this use case, the first of which is the subject of this issue:
matching()
.For the first, I'd propose adding roughly the following functionality to the YesNo API:
Note that this essentially adds the core functionality of nock, which is to provide a mock response for a specified path. To further allow providing a custom response, it may make sense to
I believe this should greatly increase the usability of the library for those new to this testing approach, and will make it easier to recommend this library over nock. I believe @samwhale encountered a use case for this recently and may be able to weigh on whether it'd address his need.
The text was updated successfully, but these errors were encountered: