Skip to content

Commit

Permalink
tests: add req.session.populated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Nov 9, 2014
1 parent 59d644c commit 3ac2865
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,33 @@ describe('Cookie Session', function(){
})
})
})

describe('req.session', function () {
describe('.populated', function () {
it('should be false on new session', function (done) {
var app = App();
app.use(function (req, res, next) {
res.end(String(req.session.populated))
})

request(app.listen())
.get('/')
.expect(200, 'false', done)
})

it('should be true after adding property', function (done) {
var app = App();
app.use(function (req, res, next) {
req.session.message = 'hello!'
res.end(String(req.session.populated))
})

request(app.listen())
.get('/')
.expect(200, 'true', done)
})
})
})
})

function App(options) {
Expand Down

0 comments on commit 3ac2865

Please sign in to comment.