test-drain-event.js 428 B

123456789101112131415161718192021
  1. var common = require('../../common');
  2. var connection = common.createConnection();
  3. var assert = require('assert');
  4. connection.connect();
  5. var got_drain = false;
  6. connection.on('drain', function() {
  7. got_drain = true;
  8. });
  9. connection.query("SELECT 1", function(err) {
  10. assert.equal(got_drain, false);
  11. assert.ok(!err);
  12. process.nextTick(function() {
  13. assert.equal(got_drain, true);
  14. connection.end();
  15. });
  16. });