test-fatal-network-error-going-to-all-callbacks.js 528 B

12345678910111213141516171819202122
  1. var common = require('../../common');
  2. var connection = common.createConnection({port: common.bogusPort});
  3. var assert = require('assert');
  4. var errors = {};
  5. connection.connect(function(err) {
  6. assert.equal(errors.a, undefined);
  7. errors.a = err;
  8. });
  9. connection.query('SELECT 1', function(err) {
  10. assert.equal(errors.b, undefined);
  11. errors.b = err;
  12. });
  13. process.on('exit', function() {
  14. assert.equal(errors.a.code, 'ECONNREFUSED');
  15. assert.equal(errors.a.fatal, true);
  16. assert.strictEqual(errors.a, errors.b);
  17. });