Skip to content

Commit

Permalink
test: add coverage for clear() errors re: #30
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Oct 7, 2016
1 parent 9a64af8 commit 721b66a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,20 @@ describe('connectMongoDBSession', function() {
done();
});
});
});

});
it('handles set() errors', function(done) {
var SessionStore = connectMongoDBSession({ Store: StoreStub });

var session = new SessionStore();
db.remove.on('called', function(args) {
args.callback(new Error('fail!'));
});

session.clear(function(error) {
assert.ok(error);
assert.equal(error.message, 'Error clearing all sessions: fail!');
done();
});
});
});
});

0 comments on commit 721b66a

Please sign in to comment.