From 48cd00874996a81b5c7eb9dfefcd31f9bbb9609c Mon Sep 17 00:00:00 2001 From: Ward Bell Date: Fri, 28 Oct 2016 12:40:43 -0700 Subject: [PATCH] docs(testing): 'testingService' -> 'twainService' plus clarity (#2692) --- public/docs/ts/latest/guide/testing.jade | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/docs/ts/latest/guide/testing.jade b/public/docs/ts/latest/guide/testing.jade index dc6d40452e..15bd5f9baf 100644 --- a/public/docs/ts/latest/guide/testing.jade +++ b/public/docs/ts/latest/guide/testing.jade @@ -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".