title: Why is my react unit test import not working?
body: <p>The <strong>navList.js</strong> is correct when I run <code>npm run watch</code>.</p>
  
  <p>But when I try to run <code>npm test</code>, the log only shows <code>setArticleGroup: 1</code> ( <code>setArticleGroup: 2</code> and <code>setArticleGroup: 3</code> are missing ).</p>
  
  <p>I realize that <code>getArticlesFromDatabase</code> is not work in test, why is this the case?</p>
  
  <p><strong>navList.test.js</strong></p>
  
  <pre><code>it('function setArticleGroup() ', function () {
      let app = shallow(&lt;NavList sieve="info" /&gt;);
  });
  </code></pre>
  
  <p><strong>navList.js</strong></p>
  
  <pre><code>import {getArticlesFromDatabase} from '../csrfData';
  
  setArticleGroup(){
      let that = this;
      console.log('setArticleGroup: 1   ');
  
      getArticlesFromDatabase.then(function(value) {
          console.log('setArticleGroup: 2   ');
  
          ...//skip
  
          that.setState({'articleGroup':articleGroup},()=&gt;{
              console.log('setArticleGroup: 3   ',articleGroup);
          });
      });
  }
  </code></pre>
  
  <p><strong>csrfData.js</strong></p>
  
  <pre><code>var getArticlesFromDatabase = new Promise(function(resolve, reject) {
      let articles;
      axios.get('../api/articles/get-articles-list').then(response=&gt;{
          articles = response.data.list;
          resolve(articles);
      }).catch(function (error) {
          console.log(error);
      });
  });
  
  export {getArticlesFromDatabase,testCsrfData};
  </code></pre>