UNPKG

mongojs

Version:

Easy to use module that implements the mongo api

18 lines (13 loc) 512 B
var test = require('tape') var mongojs = require('../') test('connect non existing db', function (t) { var db = mongojs('mongodb://1.0.0.1:23/aiguillage?connectTimeoutMS=100', ['a']) db.on('error', console.log) db.runCommand({ ping: 1 }, function (err) { t.ok(err, 'Should yield an error if non connection to db could be established') db.runCommand({ ping: 1 }, function (err) { t.ok(err, 'Should yield an error if non connection to db could be established') t.end() }) }) })