fbgraph icon indicating copy to clipboard operation
fbgraph copied to clipboard

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

Open FahriDevZ opened this issue 7 years ago • 0 comments

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)

FahriDevZ avatar Dec 11 '18 09:12 FahriDevZ