Testing HTTP with HttpClientTestingModule
Explain how HttpClientTestingModule and HttpTestingController let you assert on and mock outgoing HTTP requests.
Testing code that calls HttpClient shouldn't make real network requests — that would make tests slow, flaky (dependent on network conditions and a real backend being available), and hard to control for specific edge cases like error responses. HttpClientTestingModule (or, in newer standalone-based setups, provideHttpClientTesting()) replaces HttpClient's real backend with a controllable mock, and HttpTestingController is the test utility for asserting on and responding to the requests that were actually made.
It's like testing a mail-order process using a fake postal counter that lets you specify exactly what response letter comes back for any given outgoing request, and then checking the counter's logbook at the end to make sure no unexpected letters were mailed that you didn't account for.