docs(testing): 'testingService' -> 'twainService' plus clarity (#2692)
This commit is contained in:
parent
b44cc42f3a
commit
48cd008749
|
@ -743,11 +743,12 @@ a(href="#top").to-top Back to top
|
||||||
## _whenStable_
|
## _whenStable_
|
||||||
The test must wait for the `getQuote` promise to resolve in the next turn of the JavaScript engine.
|
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`
|
This test has no direct access to the promise returned by the call to `twainService.getQuote`
|
||||||
which is private and inaccessible inside `TwainComponent`.
|
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_
|
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.
|
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".
|
In fact, the _whenStable_ promise resolves when _all pending asynchronous activities within this test_ complete ... the definition of "stable".
|
||||||
|
|
Loading…
Reference in New Issue