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
There are times when it would be convenient to await the completion of network requests. This would be a promise based version of scope.isDone(). It would resolve when the scope is done and network requests have been sent.
When used in combination of the act()test utilities this could provide a compact way to assert that a response has been sent and component updates are complete.
constsearchResults=nock(API_HOST).post(SEARCH_ROUTE,searchMatcher).reply(searchResultReply)// ... a component is rendered that makes a requestawaitact(async()=>{awaitsearchResults.isDoneP();});expect(renderer.root.findAllByType('span').map(({children})=>children)).toEqual([....]);
Alternatives
Here's a draft of a function that provides similar functionality:
Please avoid duplicates
Context
There are times when it would be convenient to await the completion of network requests. This would be a promise based version of
scope.isDone()
. It would resolve when the scope is done and network requests have been sent.When used in combination of the
act()
test utilities this could provide a compact way to assert that a response has been sent and component updates are complete.Alternatives
Here's a draft of a function that provides similar functionality:
can be used as
If the feature request is accepted, would you be willing to submit a PR?
The text was updated successfully, but these errors were encountered: