test-destroy-connection.js 568 B

123456789101112131415161718
  1. var common = require('../../common');
  2. var assert = require('assert');
  3. var Connection = require(common.lib + '/Connection');
  4. var pool = common.createPool();
  5. pool.getConnection(function(err, connection) {
  6. if (err) throw err;
  7. assert.strictEqual(connection, pool._allConnections[0]);
  8. connection.destroy();
  9. assert.ok(pool._allConnections.length == 0);
  10. assert.ok(connection._poolRemoved);
  11. assert.strictEqual(connection.end, Connection.prototype.end);
  12. assert.strictEqual(connection.destroy, Connection.prototype.destroy);
  13. pool.end();
  14. });