Code example is TestBed.get but description says TestBed.inject in the HTTP guide

📚 Docs or angular.io bug report

Description

The Testing HTTP requests section of the HTTP guide has contradictory code and explanation.

The method TestBed.get is being used but the description says TestBed.inject.

🔬 Minimal Reproduction

  1. Navigate to https://angular.io/guide/http
  2. Within that page, go to section Testing HTTP Requests -> Setup (https://angular.io/guide/http#setup-1)
  3. Look at the last lines of the block of code named app/testing/http-client.spec.ts(setup) and the description after it

What’s the affected URL?

https://angular.io/guide/http

Expected vs Actual Behavior

TestBed.get should be TestBed.inject.

Alternatively, explanation should say TestBed.get() instead of TestBed.inject(), but because of what is said in https://angular.io/guide/testing#angular-testbed the first option would be prefered.

📷Screenshot

image

Anything else relevant?

Not a duplicate of #30750 because this issue is about a mismatch between the code and the description.

2 thoughts on “Code example is TestBed.get but description says TestBed.inject in the HTTP guide

Comments are closed.