title: TypeError: Cannot read property 'split' of undefined - ReactJS
body: <p>I am a beginner and I have to check some ReactJS components by doing automated tests. This is my first one, I expect to success to login with good e-mail and password.</p>
  
  <pre><code>import React from 'react';
  import ReactDOM from 'react-dom';
  import Login from '../Login';
  
  it('should log in user in valid session', () =&gt; {
      const div = document.createElement('div');
      request(Login)
          .send({"email": "xxx@xxx.com", "password": "1234"});
      ReactDOM.render(&lt;Login message={"The user is connected"} /&gt;, div);
  });
  </code></pre>
  
  <p>But when I use <strong>npm run test</strong>, it returns me the following sentences:</p>
  
  <pre><code> FAIL  src/components/test/Login.test.js   ● Test suite failed to run
  
      TypeError: Cannot read property 'split' of undefined
  
        at getApiHeader (src/libraries/global.js:312:77)
        at Object.&lt;anonymous&gt; (src/libraries/global.js:325:14)
        at Object.&lt;anonymous&gt; (src/components/Login.js:2:41)
        at Object.&lt;anonymous&gt; (src/components/test/Login.test.js:3:40)
  </code></pre>
  
  <p>Do you have an idea of what happened? I didn't find any answer corresponding to what I did. Thank you!</p>