OverrideComponent with TestBed
I have MainComponent that uses ChildComponentA as a @ViewChild . MainComponent is calling a method on ChildComponentA . I want to write an unit test case mocking ChildComponentA . How can I do this using TestBed (in Angular 2 RC5)? Before I used to use overrideDirective(MainComponentName, ChildComponentA, MockChildComponentA); Is there an equivalent to this using TestBed ? I tried using TestBed.overrideComponent(ChildComponentA,{ set: { template: '<div></div>' } }); which just sets the template, but I want to mock the methods in the component as well. I think in this case you can try and