Skip to content

Commit 0c1114d

Browse files
committed
refactor(topology): report topology state for helper methods
1 parent b493e1b commit 0c1114d

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

lib/core/sdam/topology.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -712,15 +712,12 @@ class Topology extends EventEmitter {
712712
return this.s.clientInfo;
713713
}
714714

715-
// Legacy methods for compat with old topology types
716715
isConnected() {
717-
// console.log('not implemented: `isConnected`');
718-
return true;
716+
return this.s.state === STATE_CONNECTED;
719717
}
720718

721719
isDestroyed() {
722-
// console.log('not implemented: `isDestroyed`');
723-
return false;
720+
return this.s.state === STATE_CLOSED;
724721
}
725722

726723
unref() {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"scripts": {
6565
"atlas": "node ./test/atlas_connectivity_tests.js",
6666
"test": "npm run lint && mocha --recursive test/functional test/unit test/core",
67+
"test-nolint": "mocha --recursive test/functional test/unit test/core",
6768
"coverage": "istanbul cover mongodb-test-runner -- -t 60000 test/core test/unit test/functional",
6869
"lint": "eslint lib test",
6970
"format": "prettier --print-width 100 --tab-width 2 --single-quote --write 'test/**/*.js' 'lib/**/*.js'",

0 commit comments

Comments
 (0)