Angular · Middle · Question 48 of 75

How do you test a service that uses HttpClient without real network calls?

Explanation

httpTesting.expectOne('/api/users').flush([...]) returns a fake response, and verify() in afterEach ensures no unexpected requests were made.

Further reading

Problem with a question

Angular · Middle · question 48

Test yourself

Take the Angular · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz