angular/packages/common/http/testing/src/module.ts
Alex Rickabaugh 84d0d33c35 feat(http): introduce provideHttpClientTesting provider function (#47502)
This commit introduces the `provideHttpClientTesting()` function as an
alternative to the `HttpClientTestingModule` (in fact, the NgModule is
converted internally to just use the new provider function).

PR Close #47502
2022-10-06 19:02:45 +00:00

31 lines
692 B
TypeScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {HttpClientModule} from '@angular/common/http';
import {NgModule} from '@angular/core';
import {provideHttpClientTesting} from './provider';
/**
* Configures `HttpClientTestingBackend` as the `HttpBackend` used by `HttpClient`.
*
* Inject `HttpTestingController` to expect and flush requests in your tests.
*
* @publicApi
*/
@NgModule({
imports: [
HttpClientModule,
],
providers: [
provideHttpClientTesting(),
],
})
export class HttpClientTestingModule {
}