docs(testing): 'testingService' -> 'twainService' plus clarity (#2692)

This commit is contained in:
Ward Bell 2016-10-28 12:40:43 -07:00 committed by GitHub
parent b44cc42f3a
commit 48cd008749
1 changed files with 4 additions and 3 deletions

View File

@ -743,11 +743,12 @@ a(href="#top").to-top Back to top
## _whenStable_
The test must wait for the `getQuote` promise to resolve in the next turn of the JavaScript engine.
This test has no direct access to the promise returned by the call to `testService.getQuote`
which is private and inaccessible inside `TwainComponent`.
This test has no direct access to the promise returned by the call to `twainService.getQuote`
because it is buried inside `TwainComponent.ngOnInit` and therefore inaccessible to a test that
probes only the component API surface.
Fortunately, the `getQuote` promise is accessible to the _async test zone_
which intercepts all promises issued within the _async_ method call.
which intercepts all promises issued within the _async_ method call _no matter where they occur_.
The `ComponentFixture.whenStable` method returns its own promise which resolves when the `getQuote` promise completes.
In fact, the _whenStable_ promise resolves when _all pending asynchronous activities within this test_ complete ... the definition of "stable".