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, shown as follows:
I have provided fake implementations of ObservableMedia, MatIconRegistry, DomSanitizer, along with arrays for commonTestingProviders and commonTestingModules.
src/app/common/common.testing.ts
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { MediaChange } from '@angular/flex-layout'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { SafeResourceUrl, SafeValue...