title: How to mock set state and method from protected abstracts method in React Jest
body: <p>This is how the components are arranged</p>
  <pre><code>class A extends React.Component {
    state = {mode: 'create'}
  
    abstract getRows() {
      
    }
  
    abstract getTitle(){
       
    }
  }
  
  class B extends A {
     getTitle(){
       if(this.state.mode === 'create'){ return 'New';}
       else {return 'Existing'};
     }
  }
  </code></pre>
  <p>And in test case:</p>
  <pre><code>jest.mock('componentAFile');
  
  component = shallow(&lt;B /&gt;);
  
  component.setState({mode: 'create'});
  expect(component.instance().getTitle()).toBe('New');
  
  component.setState({mode: 'edit'});
  expect(component.instance().getTitle()).toBe('Existing');
  </code></pre>
  <p>But state mode says undefined. What is the correct way to do this? How do we test such classes inheriting from base classes?</p>