Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mocha test Error: done() called multiple times when request timeout #140

Open
FahriDevZ opened this issue Dec 11, 2018 · 0 comments
Open

Comments

@FahriDevZ
Copy link

This problem occurs when I set the timeout option.

Examlpe:

const fbgraph = require('fbgraph');
const token = 'xxx'; // access token

describe('test1', () => {
  it('fbgraph', done => {
    fbgraph.setAccessToken( token );
    fbgraph.setOptions( { timeout:  10 } );
    fbgraph.fql(`
      SELECT
        uid,
        sex,
        current_location.country
      FROM
        user
      WHERE
        uid in (
          SELECT
            uid_from
          FROM
            friend_request
          WHERE
            uid_to = me()
        )
        AND NOT (locale = 'id_ID')
      ORDER BY
        uid DESC;
    `, {
      locale: 'en_US'
    }, ( error, response ) => {
      if ( error ) {
          return done( error );
      }
      done();
    });
  });

});

result:

  test1
    ✓ fbgraph (221ms)
    1) fbgraph


  1 passing (232ms)
  1 failing

  1) test1
       fbgraph:
     Error: done() called multiple times
      at Graph.fbgraph.fql [as callback] (test/fbgraph.test.js:60:7)
      at Request.<anonymous> (node_modules/fbgraph/lib/graph.js:200:11)
      at Timeout._onTimeout (node_modules/request/request.js:852:16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant