sessionstore
Advanced tools
Comparing version 0.2.8 to 0.3.0
@@ -1,6 +0,6 @@ | ||
var util = require(process.binding('natives').util ? 'util' : 'sys') | ||
, Session = require('express').session | ||
, _ = require('lodash') | ||
, async = require('async') | ||
, cradle = require('cradle'); | ||
var util = require(process.binding('natives').util ? 'util' : 'sys'), | ||
Session = require('express').session, | ||
_ = require('lodash'), | ||
async = require('async'), | ||
cradle = require('cradle'); | ||
@@ -76,3 +76,3 @@ var CouchDbSessionStore = function(options, callback) { | ||
finish(); | ||
} | ||
} | ||
}); | ||
@@ -79,0 +79,0 @@ }; |
@@ -1,6 +0,6 @@ | ||
var util = require(process.binding('natives').util ? 'util' : 'sys') | ||
, Session = require('express').session | ||
, mongo = require('mongodb') | ||
, ObjectID = mongo.BSONPure.ObjectID | ||
, _ = require('lodash'); | ||
var util = require(process.binding('natives').util ? 'util' : 'sys'), | ||
Session = require('express').session, | ||
mongo = require('mongodb'), | ||
ObjectID = mongo.BSONPure.ObjectID, | ||
_ = require('lodash'); | ||
@@ -7,0 +7,0 @@ function cleanSessionData(json) { |
@@ -1,5 +0,5 @@ | ||
var util = require(process.binding('natives').util ? 'util' : 'sys') | ||
, Session = require('express').session | ||
, _ = require('lodash') | ||
, nStore = require('nstore'); | ||
var util = require(process.binding('natives').util ? 'util' : 'sys'), | ||
Session = require('express').session, | ||
_ = require('lodash'), | ||
nStore = require('nstore'); | ||
@@ -6,0 +6,0 @@ var NStoreSessionStore = function(options, callback) { |
@@ -1,6 +0,6 @@ | ||
var util = require(process.binding('natives').util ? 'util' : 'sys') | ||
, Session = require('express').session | ||
, tingodb = require('tingodb')() | ||
, ObjectID = tingodb.ObjectID | ||
, _ = require('lodash'); | ||
var util = require(process.binding('natives').util ? 'util' : 'sys'), | ||
Session = require('express').session, | ||
tingodb = require('tingodb')(), | ||
ObjectID = tingodb.ObjectID, | ||
_ = require('lodash'); | ||
@@ -7,0 +7,0 @@ function cleanSessionData(json) { |
{ | ||
"author": "adrai", | ||
"name": "sessionstore", | ||
"version": "0.2.8", | ||
"version": "0.3.0", | ||
"private": false, | ||
@@ -19,2 +19,4 @@ "main": "index.js", | ||
"mongodb": ">= 0.0.1", | ||
"tingodb": ">= 0.0.1", | ||
"redis": ">= 0.10.1", | ||
"express": ">= 2.5.0", | ||
@@ -29,2 +31,5 @@ "mocha": ">= 1.0.1", | ||
"couchdb", | ||
"nstore", | ||
"tingodb", | ||
"redis", | ||
"memory", | ||
@@ -31,0 +36,0 @@ "database", |
@@ -64,2 +64,3 @@ # Introduction | ||
5. tingodb ([tingodb] (https://github.com/sergeyksv/tingodb)) | ||
6. redis ([redis] (https://github.com/mranney/node_redis)) | ||
@@ -66,0 +67,0 @@ # License |
@@ -1,47 +0,74 @@ | ||
var expect = require('expect.js') | ||
, sessionStore = require('../lib/sessionstore'); | ||
var expect = require('expect.js'), | ||
sessionStore = require('../lib/sessionstore'); | ||
describe('SessionStore', function() { | ||
describe('calling createSessionStore', function() { | ||
describe('without options', function() { | ||
it('it should return with the in memory store', function() { | ||
var ss = sessionStore.createSessionStore(); | ||
expect(ss).to.be.a(require('express').session.MemoryStore); | ||
}); | ||
}); | ||
describe('with options containing a type property with the value of', function() { | ||
describe('an existing db implementation', function() { | ||
it('it should return a new store', function() { | ||
var ss = sessionStore.createSessionStore({ type: 'mongoDb' }); | ||
expect(ss).to.be.a('object'); | ||
}); | ||
}); | ||
describe('an existing db implementation of redis', function() { | ||
it('it should return a new store', function() { | ||
var store = sessionStore.createSessionStore({ type: 'redis' }); | ||
expect(store).to.be.a('object'); | ||
}); | ||
it('it should set and get a session', function() { | ||
var store = sessionStore.createSessionStore({ type: 'redis' }); | ||
store.client.on('connect', function(){ | ||
// #set() | ||
store.set('123', { cookie: { maxAge: 2000 }, name: 'joe' }, function(err, result){ | ||
expect(err).to.be(null); | ||
expect(result).to.be('OK'); | ||
// #get() | ||
store.get('123', function(err, data){ | ||
expect(data.name).to.be('joe'); | ||
// #set() | ||
store.set('123', { cookie: { maxAge: 2000 }, name: 'jimmy' }, function(err, ok){ | ||
// #get() | ||
store.get('123', function(err, data){ | ||
expect(data.name).to.be('jimmy'); | ||
// #destroy() | ||
store.destroy('123', function(err, result){ | ||
expect(err).to.be(null); | ||
expect(result).to.be(1); | ||
console.log('done'); | ||
// store.client.end(); | ||
// | ||
// console.log('done'); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
describe('a non existing db implementation', function() { | ||
it('it should return a new store', function() { | ||
var ss = sessionStore.createSessionStore({ type: 'strangeDb' }); | ||
expect(ss).to.be.a(require('express').session.MemoryStore); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25735
14
579
86
6
7