From c830161dadc7e1e99d70c4e9940c36793ef54160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Fri, 10 May 2019 09:10:21 +0200 Subject: [PATCH] Fix tests to correctly assert on MongoNetworkError MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- package.json | 2 +- test/mongodb.test.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 714323ba4..46771b251 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/test/mongodb.test.js b/test/mongodb.test.js index 3e7be7a42..aa80b5e7f 100644 --- a/test/mongodb.test.js +++ b/test/mongodb.test.js @@ -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(); }); }); @@ -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(); }); });