-
Notifications
You must be signed in to change notification settings - Fork 47
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
Wait for mocked XHR to fulfil all requests #71
Comments
This is like P.S. For |
@fatso83 thanks for pointing that out. I can make a PR, i'm trying to understand how to test this in isolation and in the cotext of Sinon afterwards. I want the On |
There's too many unclear things you refer to for me to understand what you talk about.
Which Which framework are you talking about?
What is "that" referring to? If you refer to my pointing out you need to return a value, it had nothing to do with testing and everything to do with the fact that your example wasn't runnable, as the |
@fatso83 I'll try to clarify: On My original goal was to have a way to stop the I could stop the setInterval checks inside
I updated the example: function reloadApp() {
$.ajax({url: "first/url"}).then(() => {
$.ajax({url: "second/url"}).then((htmlFragment) => updateDOM(htmlFragment));
return "<markup />";
}).then((htmlFragment) => updateDOM(htmlFragment));
}
PS: you can run the POC here https://github.com/serbanghita/karma-mocha-chai-sinon |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This has a PR that's waiting review. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I'm having the following situation:
There are two ajax requests nested but not chained to one another.
I'm using Sinon.js (which uses nise).
I have no way of waiting for the second request to fulfil unless I chain the Promise which is something I cannot do without breaking compatibility (let's assume that it cannot be done).
I tried both strategies with
respondImmediately
and with theserver.respond()
.My solution is to make a helper:
This is obviously an edge case but my goal is to test the final outcome of the code and wait for all the requests to finish because they modify the HTML component that I'm testing.
Working example: https://github.com/serbanghita/karma-mocha-chai-sinon ;
Let me know your thoughts on the situation and
waitForServerToFulfillRequests
The text was updated successfully, but these errors were encountered: