title: React + enzyme unit tests, can't access window.addEventListener
body: <p>I have some unit tests set up, testing with enzyme's shallow method with a jsdom configuration. This has been working well until I have run into a component where I am using <code>window.addEventListener</code>. The unit tests is now giving back the error of </p>
  
  <pre><code>TypeError: window.addEventListener is not a function
  </code></pre>
  
  <p>I have my test helpers set up for JSdom like so </p>
  
  <pre><code>import jsdom from 'jsdom';
  
  ...
  
  global.document = jsdom.jsdom('&lt;!doctype html&gt;&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;');
  global.window = document.defaultView;
  global.navigator = {userAgent: 'node.js'};
  </code></pre>
  
  <p>this was working fine, then I upgraded to enzyme 3.x, and now I am getting this error.</p>
  
  <p>I am wondering do i need to manually mock the addEventListener now, or is there something I am doing wrong to access this.</p>