I am trying to test a simple component with jasmine that have the constructor below
constructor(public sanitizer: DomSanitizer) { }
In my test, i have a testBed like
describe("Component: myComponent", () => {
let component: myComponent;
let fixture: ComponentFixture<myComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [FormsModule, CommonModule],
declarations: [myComponent],
}).compileComponents().then(() => {
fixture = TestBed.createComponent(myComponent);
component = fixture.componentInstance;
});
}));
});
I am getting the error
Failed: Can't resolve all parameters for myComponent
I have tried everything. I followed the suggestion on the question here Test pipe with dependencies on services and imported browserModule instead of CommonModule all to no avail. Please how do i inject this dependency ? Any help would be appreciated