test(docs-infra): fix unit tests and run them for specific docs examples on CI (#36143)
Previously, only e2e tests were run for docs examples on CI. As a result, unit tests (which are included in the zipped archives we provide for users to download and play with the examples locally) were often outdated and broken. This commit configures specific docs examples that have meaningful unit tests to run them on CI (via the `run-example-e2e.js` script). Where necessary, the unit tests are fixed to ensure they pass and reflect the changes in the corresponding component/service. This commit also removes some auto-generated unit tests that are not meaningful (e.g. make trivial assertions, such that a component instance is truthy) and are often broken anyway (e.g. because the corresponding component has been changed in ways that make the tests fail). PR Close #36143
This commit is contained in:

committed by
Kara Erickson

parent
aece3669e5
commit
d707124fd9
@ -1103,18 +1103,6 @@ explains when and why you must get the service from the component's injector ins
|
||||
|
||||
</div>
|
||||
|
||||
{@a service-from-injector}
|
||||
|
||||
#### Always get the service from an injector
|
||||
|
||||
Do _not_ reference the `userServiceStub` object
|
||||
that's provided to the testing module in the body of your test.
|
||||
**It does not work!**
|
||||
The `userService` instance injected into the component is a completely _different_ object,
|
||||
a clone of the provided `userServiceStub`.
|
||||
|
||||
<code-example path="testing/src/app/welcome/welcome.component.spec.ts" region="stub-not-injected" header="app/welcome/welcome.component.spec.ts"></code-example>
|
||||
|
||||
{@a welcome-spec-setup}
|
||||
|
||||
#### Final setup and tests
|
||||
|
Reference in New Issue
Block a user