Skip to content

Commit

Permalink
fixed typo and added test for session disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
nadavs committed Jun 23, 2015
1 parent da2b8e6 commit 310f26e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/restify-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ module.exports = function(config) {
*
* @param {Function} callback Callback to execute once connection is closed
*/
session.dissconnect = function (callback) {
session.disconnect = function (callback) {
session.client.quit();
session.client.on('end', callback);
};
Expand Down
12 changes: 11 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('Restify session manager', function(){
done();
});
});
it('should whait for ttl and verify session data empty', function(done){
it('should wait for ttl and verify session data empty', function(done){
this.timeout(session.config.ttl * 1000 + 500);
var defer = setInterval(function() {
session.exists(sid, function(err, exists) {
Expand Down Expand Up @@ -112,4 +112,14 @@ describe('Restify session manager', function(){
destroySession(this, sid, done);
});
});
// This test needs to be last since it destroys the connection to redis
describe('disconnect from session', function () {
it('should not be connected to the redis DB anymore', function (done) {
session.client.connected.should.be.true;
session.disconnect(function () {
session.client.connected.should.be.false;
done();
});
});
});
});

0 comments on commit 310f26e

Please sign in to comment.