-
Notifications
You must be signed in to change notification settings - Fork 248
feat(mocks): change MockHttpBackend to define assertions on flush. #1206
Conversation
Some notes: I've added These new functions add a new expectation and then flush all the pending requests until they find the one matching the expectation.
I haven't deleted the
I can delete |
Awesome; could you add a second commit to the PR converting expects to flushGETs in the tests? |
This is a breaking change, so we need an upgrade plan. Setting this to "reviewing" until then. |
@jbdeboer This will cause issues only if there are tests that depend on the fact that the exception won't be thrown until |
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
f92ce6e
to
5e25f1f
Compare
5e25f1f
to
adbe221
Compare
@vsavkin is reviewing this change and how it effects apps. |
Add new methods (
flushGET
,flushPOST
, etc) to theMockHttpBackend
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:
After:
Closes #900, #1417