title: Testing react components: Jest encountered an unexpected token
body: <p>I am trying to test with Jest, but got an error: 
  Jest encountered an unexpected token
        This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.</p>
  
  <p>I have a photo gallery app and whenever I click on an image, a modal pops up with an image. I want to test that when I click on the image, the popup shows or exists. Is there a way to factor this?</p>
  
  <p><a href="https://i.stack.imgur.com/OfHiB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OfHiB.png" alt="enter image description here"></a>
  HERE IS MY CODE:</p>
  
  <pre><code>import { shallow, mount, render } from 'enzyme';
  import App from '../client/src/components/App';
  
  describe('&lt;PhotoItem /&gt;', () =&gt; {
    it('should popup image on click', () =&gt; {
      const wrapper = shallow(
        &lt;App title="mock" /&gt;
      );
      wrapper.find('.item item-0').simulate('click');
      expect('.modal-opactiy').toExist();
    });
  </code></pre>
  
  <p>HERE is my package.json:<code>
  "jest": {
      "verbose": true,
      "transformIgnorePatterns": ["/node_modules/(?!App)"],
      "testURL": "http://localhost/photos"
    }</code></p>