Skip to content

Commit

Permalink
updating test: no more check interval for expired entries by default
Browse files Browse the repository at this point in the history
  • Loading branch information
roccomuso committed Jul 21, 2017
1 parent 1a052d3 commit 6f8da47
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions test/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ describe('MemoryStore', function (done) {
it('constructor should use default options', function (done) {
this.store = new session.MemoryStore()
var store = this.store
var oneDay = 3600000
assert.ok(store.options, 'should have an option object')
assert.equal(store.options.max, Infinity, 'max option should be Infinity')
assert.equal(store.options.checkPeriod, oneDay, 'checkPeriod equal to ' + oneDay + ' by default')
assert.equal(store.options.checkPeriod, undefined, 'checkPeriod undefined by default')
assert.ok(store.store, 'should have the LRU cache store')
assert.ok(store._checkInterval, 'should have the pruning loop')
assert.equal(store._checkInterval, undefined, 'should not have the pruning loop')
done()
})

Expand All @@ -39,6 +38,13 @@ describe('MemoryStore', function (done) {
done()
})

it('should not set the interval to check for expired entries by default', function (done) {
this.store = new session.MemoryStore()
var store = this.store
assert.equal(store._checkInterval, undefined, 'should not exists')
done()
})

it('should only contain 10 items', function (done) {
this.store = new session.MemoryStore({max: 10})
var store = this.store
Expand Down Expand Up @@ -171,7 +177,7 @@ describe('MemoryStore', function (done) {
}, 300)
})

it('should prune expired entries', function (done) {
it('should enable automatic prune for expired entries', function (done) {
this.store = new session.MemoryStore({checkPeriod: 300})
var store = this.store

Expand All @@ -190,8 +196,8 @@ describe('MemoryStore', function (done) {
}, 500)
})

it('should disable automatic check for expired', function (done) {
this.store = new session.MemoryStore({checkPeriod: false})
it('automatic check for expired entries should be disabled', function (done) {
this.store = new session.MemoryStore()
var store = this.store

store.set('foo', {cookie: {maxAge: 150}})
Expand Down

0 comments on commit 6f8da47

Please sign in to comment.