Skip to content

Commit

Permalink
Added missing unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
joetinoco committed Oct 7, 2016
1 parent b09ffa8 commit f64e73f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,4 +412,33 @@ describe('connectMongoDBSession', function() {
});
});
});

describe('clear()', function(done){
var numIndexCalls;

beforeEach(function() {
numIndexCalls = 0;

db.ensureIndex.on('called', function(args) {
assert.equal(++numIndexCalls, 1);
assert.equal(args.index.expires, 1);
args.callback();
});
});

it('clears the session store', function(done) {
var SessionStore = connectMongoDBSession({ Store: StoreStub });

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

session.clear(function(error) {
assert.ifError(error);
done();
});
});
});

});

0 comments on commit f64e73f

Please sign in to comment.