Skip to content

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

Open

Description

@FahriDevZ

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions