Skip to content

Commit 3ac0a78

Browse files
CodeF0xpkozlowski-opensource
authored andcommitted
docs(http): heads up about provider ordering (angular#56518)
PR Close angular#56518
1 parent ef5412c commit 3ac0a78

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

adev/src/content/guide/http/testing.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ At the end, tests can verify that the app made no unexpected requests.
88

99
## Setup for testing
1010

11-
To begin testing usage of `HttpClient`, configure `TestBed` and include `provideHttpClient()` and `provideHttpClientTesting` in your test's setup. This configures `HttpClient` to use a test backend instead of the real network. It also provides `HttpTestingController`, which you'll use to interact with the test backend, set expectations about which requests have been made, and flush responses to those requests. `HttpTestingController` can be injected from `TestBed` once configured.
11+
To begin testing usage of `HttpClient`, configure `TestBed` and include `provideHttpClient()` and `provideHttpClientTesting()` in your test's setup. This configures `HttpClient` to use a test backend instead of the real network. It also provides `HttpTestingController`, which you'll use to interact with the test backend, set expectations about which requests have been made, and flush responses to those requests. `HttpTestingController` can be injected from `TestBed` once configured.
12+
13+
Keep in mind to provide `provideHttpClient()` **before** `provideHttpClientTesting()`, as `provideHttpClientTesting()` will overwrite parts of `provideHttpCient()`. Doing it the other way around can potentially break your tests.
1214

1315
<docs-code language="ts">
1416
TestBed.configureTestingModule({

0 commit comments

Comments
 (0)