<commit_before>/* global describe, it */
/* jshint expr:true */
'use strict';

var mongodb = require('..');
var should = require('should');

describe('connection', function () {
    it('should connect pass error on fail', function (done) {
        var middleware = mongodb({
            host: 'undefined',
            retries: 1
        });

        middleware({}, {}, function (err) {
            should(err).is.ok;
            done();
        });
    });

    it('should connect to mongodb', function (done) {
        var middleware = mongodb();
        var req = {};
        middleware(req, {}, function (err) {
            should(req.db).is.ok;
            done(err);
        });
    });
});<commit_msg>Decrease reconnect timeout<commit_after>/* global describe, it */
/* jshint expr:true */
'use strict';

var mongodb = require('..');
var should = require('should');

describe('connection', function () {
    it('should connect pass error on fail', function (done) {
        var middleware = mongodb({
            host: 'undefined',
            retries: 1,
            reconnectTimeout: 1
        });

        middleware({}, {}, function (err) {
            should(err).is.ok;
            done();
        });
    });

    it('should connect to mongodb', function (done) {
        var middleware = mongodb();
        var req = {};
        middleware(req, {}, function (err) {
            should(req.db).is.ok;
            done(err);
        });
    });
});
{'fraction_non_alphanumeric': 0.16575342465753426, 'fraction_numerical': 0.002054794520547945, 'mean_word_length': 1.9278557114228456, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5773765', 'n_tokens_mistral': 425, 'n_tokens_neox': 407, 'n_words': 108}