diff --git a/promise.js b/promise.js index 8286730046..312c6bff08 100644 --- a/promise.js +++ b/promise.js @@ -216,6 +216,14 @@ class PromiseConnection extends EventEmitter { }); }); } + + get config() { + return this.connection.config; + } + + get threadId() { + return this.connection.threadId; + } } function createConnection(opts) { diff --git a/test/integration/promise-wrappers/test-promise-wrappers.js b/test/integration/promise-wrappers/test-promise-wrappers.js index dc6d649a36..3fc3c8de74 100644 --- a/test/integration/promise-wrappers/test-promise-wrappers.js +++ b/test/integration/promise-wrappers/test-promise-wrappers.js @@ -393,6 +393,24 @@ function testChangeUser() { }); } +function testConnectionProperties() { + let connResolved; + createConnection(config) + .then(conn => { + connResolved = conn; + assert.equal(typeof conn.config, 'object'); + assert.ok('queryFormat' in conn.config); + assert.equal(typeof conn.threadId, 'number'); + return connResolved.end(); + }) + .catch(err => { + if (connResolved) { + connResolved.end(); + } + throw err; + }); +} + function timebomb(fuse) { let timebomb; @@ -434,6 +452,7 @@ testErrorsPool(); testObjParamsPool(); testEventsPool(); testChangeUser(); +testConnectionProperties(); testPoolConnectionDestroy(); testPromiseLibrary();