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
Idea: Make a new AsyncTestingController to mimic Angular's HttpTestingController, to enable a consistent DX between testing both kinds of APIs.
The API may end up being used something like:
constclipboardController=newAsyncTestingController(navigator.clipboard,['readText','writeText'],ctx);clipboardController.expectNone('readText');navigator.clipboard.readText().then((text)=>console.log(text));constcalls=clipboardController.match('readText');// -or-constcalls=clipboardController.match((call: CallInfo<Navigator['readText']>)=>true);consttestCall=clipboardController.expectOne('readText');// -or-consttestCall=clipboardController.expectOne((call: CallInfo<Navigator['readText']>)=>{// return boolean});console.log(testCall.call.args);// `.call` is the jasmine CallInfo objecttestCall.flush('resolve with this, with type safety');testCall.error('a rejection reason of type any');clipboardController.verify();
Should calling flush() or error() after one of them was already called cause an error? (See what HttpTestingController does)?
It would be nice for it to optionally interop with an AngularContext to trigger change detection on flush() and error(). (But first verify that zone.js does that in real life.)
Use jasmine spies so that it automatically cleans up after itself after each test
The text was updated successfully, but these errors were encountered:
ersimont
changed the title
[ng-dev] Async stubbing framework
[ng-dev] Feature request: AsyncTestingController
Dec 10, 2020
Idea: Make a new
AsyncTestingController
to mimic Angular'sHttpTestingController
, to enable a consistent DX between testing both kinds of APIs.The API may end up being used something like:
flush()
orerror()
after one of them was already called cause an error? (See whatHttpTestingController
does)?AngularContext
to trigger change detection onflush()
anderror()
. (But first verify thatzone.js
does that in real life.)The text was updated successfully, but these errors were encountered: