Skip to content

Commit

Permalink
test: catch exception
Browse files Browse the repository at this point in the history
if collectionNames throws exception, catch it to make testing keep
running.
  • Loading branch information
walkingice committed Mar 31, 2015
1 parent 415c1d8 commit 370a3a8
Showing 1 changed file with 50 additions and 50 deletions.
100 changes: 50 additions & 50 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,31 +372,31 @@ exports['clear'] = {
},

'drops the db if collections not specified': function(test) {
async.series([
function(cb) {
loader.clear(cb);
},

function(cb) {
loadCollection('archer', function(err, docs) {
if (err) return cb(err);

test.same(0, docs.length);

cb();
});
},

function(cb) {
loadCollection('southpark', function(err, docs) {
if (err) return cb(err);

test.same(0, docs.length);

cb();
});
}
], test.done);
try {
async.series([
function(cb) {
loader.clear(cb);
},
function(cb) {
loadCollection('archer', function(err, docs) {
if (err) return cb(err);

test.same(0, docs.length);
cb();
});
},
function(cb) {
loadCollection('southpark', function(err, docs) {
if (err) return cb(err);

test.same(0, docs.length);
cb();
});
}
], test.done);
} catch (e) {
test.done(e);
}
},

'clears a collection if called with a string': function(test) {
Expand Down Expand Up @@ -480,31 +480,31 @@ exports['clearAllAndLoad'] = {
{ name: 'Kyle' }
];

async.series([
function(cb) {
loader.clearAllAndLoad(data, cb);
},

function(cb) {
loadCollection('archer', function(err, docs) {
if (err) return cb(err);

test.same(0, docs.length);

cb();
});
},

function(cb) {
loadCollection('southpark', function(err, docs) {
if (err) return cb(err);

test.same(1, docs.length);

cb();
});
}
], test.done);
try {
async.series([
function(cb) {
loader.clearAllAndLoad(data, cb);
},
function(cb) {
loadCollection('archer', function(err, docs) {
if (err) return cb(err);

test.same(0, docs.length);
cb();
});
},
function(cb) {
loadCollection('southpark', function(err, docs) {
if (err) return cb(err);

test.same(1, docs.length);
cb();
});
}
], test.done);
} catch (e) {
test.done(e);
}
}
};

Expand Down

0 comments on commit 370a3a8

Please sign in to comment.