Skip to content
Myr

spec.plugins.session.js

This file

Path

spec/spec.plugins.session.js

39 lines · 1.1 KiB · JavaScript

Last changed by

Bulk of memory store based session support complete.visionmediabefore adoptionf4b4c03

History of this file

Take it

Started Session pluginvisionmediabefore adoption7238afb

lines 1–9why, one step back
1
2describe 'Express'3 before_each4 reset()5 use(require('express/plugins/cookie').Cookie)6 use(require('express/plugins/session').Session)7 end8 9 describe 'Session'

Bulk of memory store based session support complete.visionmediabefore adoptionf4b4c03

lines 10–36why, one step back
10 describe 'when sid cookie is not present'
11 it 'should set sid cookie'12 get('/login', function(){ return '' })13 get('/login').headers['set-cookie'].should.match(/^sid=(\w+);/)14 end15 end16 17 describe 'when sid cookie is present'18 it 'should not set sid'19 get('/login', function(){ return '' })20 get('/login', { headers: { cookie: 'sid=123' }}).headers.should.not.have_property 'set-cookie'21 end22 end23 24 describe 'with MemoryStore'25 it 'should persist'26 post('/login', function(){27 return this.session.name = 'tj'28 })29 get('/login', function(){30 return this.session.name31 })32 var headers = { headers: { cookie: 'sid=123' }}33 post('/login', headers)34 get('/login', headers).status.should.eql 20035 get('/login', headers).body.should.eql 'tj'36 end

Started Session pluginvisionmediabefore adoption7238afb

lines 37–39why, one step back
37 end
38 end39end