title: window.history.back() not being called - jest enzyme
body: <p>I wrote a simple unit test for the following. I am new to React JS testing - Trying to run a test using jest and enzyme.</p>
  
  <pre><code>     render() {
    return (
      &lt;div&gt;
        &lt;div className="not-found"&gt;
        &lt;div className='_2'&gt;WAS NOT FOUND&lt;/div&gt;
              &lt;div onClick={() =&gt; {window.history.back()}} className='not-found- 
   btn' href='/'&gt;GO BACK&lt;/div&gt;
  </code></pre>
  
  <p>
        )
         }
       }</p>
  
  <p>The file looks simple, there are no props and the only thing not being covered when the test is running is onClick . How could I test onClick and make sure the test is 100 % covered. Thanks</p>
  
  <pre><code> &lt;div onClick={() =&gt; {window.history.back()}} className='not-found- 
   btn' href='/'&gt;GO BACK&lt;/div&gt;
  </code></pre>
  
  <p>file.test.js </p>
  
  <pre><code>  // jest mock functions (mocks this.props.func)
     const onClick =  jest.fn();
   // defining this.props
   const baseProps = {
    onClick,
  }
  
  describe(' Test', () =&gt; {
  let wrapper;
  let tree;
  
   beforeEach(() =&gt; wrapper = shallow(&lt;Component{...baseProps } /&gt;));
  // before each test, shallow mount the Component
  
  it('should render correctly', () =&gt; {  
  tree = renderer.create(&lt;NotFound {...baseProps} /&gt;)
  let treeJson = tree.toJSON()
  expect(treeJson).toMatchSnapshot();
  tree.unmount()
  });
  
         it('calls onClick event ', () =&gt; {
    const mockOnClick = jest.fn();
   const wrapper = shallow(
      &lt;NotFound onClick={mockOnClick} className='not-found-btn' /&gt;
    );
    const component = wrapper.shallow();
    component.find('GO BACK').simulate('click');
    expect(mockOnClick.mock.calls.length).toEqual(1);
  </code></pre>