docs(http): Make name of injected HttpTestingController consistent
This commit is contained in:
parent
59c23c7bd7
commit
256bc8acdd
|
@ -614,7 +614,7 @@ it('expects a GET request', inject([HttpClient, HttpTestingController], (http: H
|
||||||
req.flush({name: 'Test Data'});
|
req.flush({name: 'Test Data'});
|
||||||
|
|
||||||
// Finally, assert that there are no outstanding requests.
|
// Finally, assert that there are no outstanding requests.
|
||||||
mockHttp.verify();
|
httpMock.verify();
|
||||||
}));
|
}));
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -622,7 +622,7 @@ The last step, verifying that no requests remain outstanding, is common enough f
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
afterEach(inject([HttpTestingController], (httpMock: HttpTestingController) => {
|
afterEach(inject([HttpTestingController], (httpMock: HttpTestingController) => {
|
||||||
mockHttp.verify();
|
httpMock.verify();
|
||||||
}));
|
}));
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -631,7 +631,7 @@ afterEach(inject([HttpTestingController], (httpMock: HttpTestingController) => {
|
||||||
If matching by URL isn't sufficient, it's possible to implement your own matching function. For example, you could look for an outgoing request that has an Authorization header:
|
If matching by URL isn't sufficient, it's possible to implement your own matching function. For example, you could look for an outgoing request that has an Authorization header:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const req = mockHttp.expectOne((req) => req.headers.has('Authorization'));
|
const req = httpMock.expectOne((req) => req.headers.has('Authorization'));
|
||||||
```
|
```
|
||||||
|
|
||||||
Just as with the `expectOne()` by URL in the test above, if 0 or 2+ requests match this expectation, it will throw.
|
Just as with the `expectOne()` by URL in the test above, if 0 or 2+ requests match this expectation, it will throw.
|
||||||
|
@ -642,7 +642,7 @@ If you need to respond to duplicate requests in your test, use the `match()` API
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// Expect that 5 pings have been made and flush them.
|
// Expect that 5 pings have been made and flush them.
|
||||||
const reqs = mockHttp.match('/ping');
|
const reqs = httpMock.match('/ping');
|
||||||
expect(reqs.length).toBe(5);
|
expect(reqs.length).toBe(5);
|
||||||
reqs.forEach(req => req.flush());
|
reqs.forEach(req => req.flush());
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue