Skip to content

Commit

Permalink
Fix tests to correctly assert on MongoNetworkError
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Bajtoš <[email protected]>
  • Loading branch information
bajtos committed May 10, 2019
1 parent 5ae39c3 commit c830161
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"bson": "^1.0.6",
"debug": "^3.1.0",
"loopback-connector": "^4.5.0",
"mongodb": "^3.1.4",
"mongodb": "^3.2.4",
"strong-globalize": "^4.1.1"
},
"devDependencies": {
Expand Down
9 changes: 6 additions & 3 deletions test/mongodb.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ describe('lazyConnect', function() {
});

ds.on('error', function(err) {
err.code.should.eql('ECONNREFUSED');
should.exist(err);
err.name.should.equal('MongoNetworkError');
err.message.should.match(/ECONNREFUSED/);
done();
});
});
Expand Down Expand Up @@ -361,8 +363,9 @@ describe('mongodb connector', function() {
port: 4, // unassigned by IANA
});
ds.ping(function(err) {
(!!err).should.be.True();
err.code.should.eql('ECONNREFUSED');
should.exist(err);
err.name.should.equal('MongoNetworkError');
err.message.should.match(/ECONNREFUSED/);
done();
});
});
Expand Down

0 comments on commit c830161

Please sign in to comment.