@@ -479,7 +479,7 @@ describe('Cookie Session', function () {
479479 it ( 'should create a session' , function ( done ) {
480480 var app = App ( )
481481 app . use ( function ( req , res , next ) {
482- req . session = { message : 'hello' }
482+ req . session = { message : 'hello' , foo : 'bar' , isChanged : true }
483483 res . end ( 'klajsdfasdf' )
484484 } )
485485
@@ -488,6 +488,19 @@ describe('Cookie Session', function () {
488488 . expect ( shouldHaveCookie ( 'session' ) )
489489 . expect ( 200 , done )
490490 } )
491+
492+ it ( 'should not error on special properties' , function ( done ) {
493+ var app = App ( )
494+ app . use ( function ( req , res ) {
495+ req . session = { message : 'hello' , isChanged : false }
496+ res . end ( )
497+ } )
498+
499+ request ( app )
500+ . get ( '/' )
501+ . expect ( shouldHaveCookie ( 'session' ) )
502+ . expect ( 200 , done )
503+ } )
491504 } )
492505
493506 describe ( 'anything else' , function ( ) {
@@ -528,6 +541,30 @@ describe('Cookie Session', function () {
528541 . get ( '/' )
529542 . expect ( 200 , 'true' , done )
530543 } )
544+
545+ it ( 'should be true loading session' , function ( done ) {
546+ var app = App ( { signed : false } )
547+ app . use ( function ( req , res ) {
548+ res . end ( String ( req . session . isPopulated ) )
549+ } )
550+
551+ request ( app )
552+ . get ( '/' )
553+ . set ( 'Cookie' , 'session=eyJtZXNzYWdlIjoiaGkifQ==' )
554+ . expect ( 200 , 'true' , done )
555+ } )
556+
557+ it ( 'should not conflict with session value' , function ( done ) {
558+ var app = App ( { signed : false } )
559+ app . use ( function ( req , res ) {
560+ res . end ( String ( req . session . isPopulated ) )
561+ } )
562+
563+ request ( app )
564+ . get ( '/' )
565+ . set ( 'Cookie' , 'session=eyJtZXNzYWdlIjoiaGkiLCJpc1BvcHVsYXRlZCI6ZmFsc2V9' )
566+ . expect ( 200 , 'true' , done )
567+ } )
531568 } )
532569 } )
533570
0 commit comments