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, I recommend creating a common testing module to contain 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 fake implementations of
ObservableMedia
,MatIconRegistry
, andDomSanitizer
, along with arrays forcommonTestingProviders
andcommonTestingModules
:src/app/common/common.testing.ts import { HttpClientTestingModule } from '@angular/common/http/ testing' import { SecurityContext } from '@angular/core' import { MediaChange } from '@angular/flex-layout' import { ReactiveFormsModule } from '@angular/forms' import { SafeResourceUrl, SafeValue } from '@angular/platform...