jeudi 25 février 2016

fetch-mock: GLOBAL is not defined

I'm using fetch-mock for writing unit test cases for functions which use isomorphic-fetch. Here is the sample test suite:

 import connect from '../../src/utils/connect';
 import fetchMock from 'fetch-mock';

 describe('Unit | Utils | connect function', () => {
  it('should make a request', (done) => {
     const urlToTest = 'http://localhost:3000/api/v1/users';
     fetchMock
      .mock(urlToTest, 200)
      .getMock();

    const response = connect(urlToTest);
    expect(response);
    done();
  });
});

When running the test cases, I get the error

/my_app/app/node_modules/fetch-mock/src/server.js: GLOBAL is not defined

I'm not able to debug this issue. Can anyone please let me know what am I doing incorrectly. Thanks

Aucun commentaire:

Enregistrer un commentaire