test-query-after-end-without-callback.js 496 B

123456789101112131415161718192021222324
  1. var common = require('../../common');
  2. var connection = common.createConnection();
  3. var assert = require('assert');
  4. var didEnd = false;
  5. connection.connect();
  6. connection.end(function(err) {
  7. if (err) throw err;
  8. didEnd = true;
  9. });
  10. var err;
  11. connection.on('error', function(_err) {
  12. err = _err;
  13. });
  14. connection.query('SELECT 1');
  15. process.on('exit', function() {
  16. assert.equal(didEnd, true);
  17. assert.equal(err.code, 'PROTOCOL_ENQUEUE_AFTER_QUIT');
  18. assert.equal(err.fatal, false);
  19. });