Skip to content

Commit

Permalink
Merge pull request #994 from trevorr/promise-connection-threadid
Browse files Browse the repository at this point in the history
Add threadId and config getters to PromiseConnection
  • Loading branch information
sidorares authored Aug 6, 2019
2 parents c3ccd42 + 004a5e4 commit 108f178
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
8 changes: 8 additions & 0 deletions promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@ class PromiseConnection extends EventEmitter {
});
});
}

get config() {
return this.connection.config;
}

get threadId() {
return this.connection.threadId;
}
}

function createConnection(opts) {
Expand Down
19 changes: 19 additions & 0 deletions test/integration/promise-wrappers/test-promise-wrappers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -434,6 +452,7 @@ testErrorsPool();
testObjParamsPool();
testEventsPool();
testChangeUser();
testConnectionProperties();
testPoolConnectionDestroy();
testPromiseLibrary();

Expand Down

0 comments on commit 108f178

Please sign in to comment.