@@ -595,6 +595,50 @@ describe("Stateful Session Store", async () => {
595
595
expect ( cookie ?. secure ) . toEqual ( false ) ;
596
596
} ) ;
597
597
598
+ it ( "should apply the path to the cookie" , async ( ) => {
599
+ const currentTime = Date . now ( ) ;
600
+ const createdAt = Math . floor ( currentTime / 1000 ) ;
601
+ const secret = await generateSecret ( 32 ) ;
602
+ const session : SessionData = {
603
+ user : { sub : "user_123" } ,
604
+ tokenSet : {
605
+ accessToken : "at_123" ,
606
+ refreshToken : "rt_123" ,
607
+ expiresAt : 123456
608
+ } ,
609
+ internal : {
610
+ sid : "auth0-sid" ,
611
+ createdAt
612
+ }
613
+ } ;
614
+ const store = {
615
+ get : vi . fn ( ) . mockResolvedValue ( session ) ,
616
+ set : vi . fn ( ) ,
617
+ delete : vi . fn ( )
618
+ } ;
619
+
620
+ const requestCookies = new RequestCookies ( new Headers ( ) ) ;
621
+ const responseCookies = new ResponseCookies ( new Headers ( ) ) ;
622
+
623
+ const sessionStore = new StatefulSessionStore ( {
624
+ secret,
625
+ store,
626
+ rolling : true ,
627
+ absoluteDuration : 3600 ,
628
+ inactivityDuration : 1800 ,
629
+
630
+ cookieOptions : {
631
+ path : "/custom-path"
632
+ }
633
+ } ) ;
634
+ await sessionStore . set ( requestCookies , responseCookies , session ) ;
635
+
636
+ const cookie = responseCookies . get ( "__session" ) ;
637
+
638
+ expect ( cookie ) . toBeDefined ( ) ;
639
+ expect ( cookie ?. path ) . toEqual ( "/custom-path" ) ;
640
+ } ) ;
641
+
598
642
it ( "should apply the cookie name" , async ( ) => {
599
643
const currentTime = Date . now ( ) ;
600
644
const createdAt = Math . floor ( currentTime / 1000 ) ;
0 commit comments