-
Notifications
You must be signed in to change notification settings - Fork 248
Change assertion apis for http backend to define the assertion on flush #900
Comments
👍 |
I'd like to work on it |
I looked a bit into it. To implement this kind of API, Right now
To make the API change possible
This is a breaking change. If the breaking change is not an option, there is another way to make tests more readable, by introducing some sort of autoFlush option.
|
We've been looking into this on the JS side as well and concluded that the I however urge you to make this change before cutting v1.0. The benefits of On Fri, Jun 20, 2014 at 9:50 AM, Victor Savkin [email protected]
|
Yup, it does make tests easier to follow. I can submit a PR with the change if it is OK with everyone. |
Add new methods (`flushGET`, `flushPOST`, etc) to the `MockHttpBackend` class to allow defining assertions on flush. These methods add a new expectation and then flush all the pending requests until they find the one matching the expectation. BREAKING CHANGE: Unexpected requests are detected only when `flush` is called. Before: backend("GET", /some"); //throws here if `/some` has not been defined After: backend("GET", /some"); //no problem, just records the request backend.flush(); //throws here The signature of `flush` has changed. Before: `flush([int count])` After: `flush({int count, Function condition})` Closes dart-archive#900
Add new methods (`flushGET`, `flushPOST`, etc) to the `MockHttpBackend` class to allow defining assertions on flush. These methods add a new expectation and then flush all the pending requests until they find the one matching the expectation. BREAKING CHANGE: Unexpected requests are detected only when `flush` is called. Before: backend("GET", /some"); //throws here if `/some` has not been defined After: backend("GET", /some"); //no problem, just records the request backend.flush(); //throws here Closes dart-archive#900
Add new methods (`flushGET`, `flushPOST`, etc) to the `MockHttpBackend` class to allow defining assertions on flush. These methods add a new expectation and then flush all the pending requests until they find the one matching the expectation. BREAKING CHANGE: Unexpected requests are detected only when `flush` is called. Before: backend("GET", /some"); //throws here if `/some` has not been defined After: backend("GET", /some"); //no problem, just records the request backend.flush(); //throws here Closes dart-archive#900
Add new methods (`flushGET`, `flushPOST`, etc) to the `MockHttpBackend` class to allow defining assertions on flush. These methods add a new expectation and then flush all the pending requests until they find the one matching the expectation. BREAKING CHANGE: Unexpected requests are detected only when `flush` is called. Before: backend("GET", /some"); //throws here if `/some` has not been defined After: backend("GET", /some"); //no problem, just records the request backend.flush(); //throws here Closes dart-archive#900
Add new methods (`flushGET`, `flushPOST`, etc) to the `MockHttpBackend` class to allow defining assertions on flush. These methods add a new expectation and then flush all the pending requests until they find the one matching the expectation. BREAKING CHANGE: Unexpected requests are detected only when `flush` is called. Before: backend("GET", /some"); //throws here if `/some` has not been defined After: backend("GET", /some"); //no problem, just records the request backend.flush(); //throws here Closes dart-archive#900
Add new methods (`flushGET`, `flushPOST`, etc) to the `MockHttpBackend` class to allow defining assertions on flush. These methods add a new expectation and then flush all the pending requests until they find the one matching the expectation. BREAKING CHANGE: Unexpected requests are detected only when `flush` is called. Before: backend("GET", /some"); //throws here if `/some` has not been defined After: backend("GET", /some"); //no problem, just records the request backend.flush(); //throws here Closes dart-archive#900
Add new methods (`flushGET`, `flushPOST`, etc) to the `MockHttpBackend` class to allow defining assertions on flush. These methods add a new expectation and then flush all the pending requests until they find the one matching the expectation. BREAKING CHANGE: Unexpected requests are detected only when `flush` is called. Before: backend("GET", /some"); //throws here if `/some` has not been defined After: backend("GET", /some"); //no problem, just records the request backend.flush(); //throws here Closes dart-archive#900
Add new methods (`flushGET`, `flushPOST`, etc) to the `MockHttpBackend` class to allow defining assertions on flush. These methods add a new expectation and then flush all the pending requests until they find the one matching the expectation. BREAKING CHANGE: Unexpected requests are detected only when `flush` is called. Before: backend("GET", /some"); //throws here if `/some` has not been defined After: backend("GET", /some"); //no problem, just records the request backend.flush(); //throws here Closes #900
instead of
do
Benefits:
The text was updated successfully, but these errors were encountered: