I am trying to test whether componentWillMount was called and for that my test is
test(\'calls `componentWillMount` before rendering\', () => {
let fn =
I would first spy on the component's componentWillMount method but also use .and.CallThrough() to prevent it from mocking its contents. Hope this helps:
it('should check that the componentWillMount method is getting called', () => {
spyOn(SomeComponent.prototype, 'componentWillMount').and.callThrough();
const wrapper = mount( );
expect(wrapper).toBeDefined();
expect(SomeComponent.prototype.componentWillMount).toHaveBeenCalledTimes(1);
});