Common testing module
Now that we have a lot of modules to deal with, it becomes tedious to configure the imports and providers for each spec
file individually. For this purpose, create a common testing module to contain a generic configuration that you can reuse across the board.
First, start by creating a new .ts
file:
- Create
common/common.testing.ts
. - Populate it with common testing providers, fakes, and modules.
I have provided a commonTestingModules
array:
src/app/common/common.testing.ts
import {
HttpClientTestingModule
} from '@angular/common/http/testing'
import { ReactiveFormsModule } from '@angular/forms'
import {
NoopAnimationsModule
} from '@angular/platform-browser/animations'
import { RouterTestingModule } from '@angular/router/testing'
import {
MatIconTestingModule
} from '@angular/material/icon/testing'
export const commonTestingProviders = [
// Intentionally left blank! Used...