@@ -479,7 +479,7 @@ describe('Cookie Session', function () {
479
479
it ( 'should create a session' , function ( done ) {
480
480
var app = App ( )
481
481
app . use ( function ( req , res , next ) {
482
- req . session = { message : 'hello' }
482
+ req . session = { message : 'hello' , foo : 'bar' , isChanged : true }
483
483
res . end ( 'klajsdfasdf' )
484
484
} )
485
485
@@ -488,6 +488,19 @@ describe('Cookie Session', function () {
488
488
. expect ( shouldHaveCookie ( 'session' ) )
489
489
. expect ( 200 , done )
490
490
} )
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
+ } )
491
504
} )
492
505
493
506
describe ( 'anything else' , function ( ) {
@@ -528,6 +541,30 @@ describe('Cookie Session', function () {
528
541
. get ( '/' )
529
542
. expect ( 200 , 'true' , done )
530
543
} )
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
+ } )
531
568
} )
532
569
} )
533
570
0 commit comments