@@ -26,8 +26,10 @@ const createCookieConfig = (
26
26
const cookies = new Map ( Object . entries ( initialCookies ) ) ;
27
27
return {
28
28
encryptionKey,
29
- getCookie : ( name : string ) => cookies . get ( name ) ,
30
- setCookie : ( name : string , value : string ) => cookies . set ( name , value ) ,
29
+ getCookie : async ( name : string ) => cookies . get ( name ) ,
30
+ setCookie : async ( name : string , value : string ) => {
31
+ cookies . set ( name , value ) ;
32
+ } ,
31
33
...otherConfigs ,
32
34
} ;
33
35
} ;
@@ -68,7 +70,8 @@ describe('CookieStorage', () => {
68
70
69
71
await storage . setItem ( PersistKey . AccessToken , 'baz' ) ;
70
72
expect ( storage . data ) . toEqual ( { [ PersistKey . AccessToken ] : 'baz' } ) ;
71
- expect ( await unwrapSession ( storage . config . getCookie ( 'logtoCookies' ) ! , encryptionKey ) ) . toEqual ( {
73
+ const cookie = await storage . config . getCookie ( 'logtoCookies' ) ;
74
+ expect ( await unwrapSession ( cookie ?? '' , encryptionKey ) ) . toEqual ( {
72
75
[ PersistKey . AccessToken ] : 'baz' ,
73
76
} ) ;
74
77
} ) ;
@@ -85,7 +88,8 @@ describe('CookieStorage', () => {
85
88
86
89
await storage . removeItem ( PersistKey . AccessToken ) ;
87
90
expect ( storage . data ) . toEqual ( { } ) ;
88
- expect ( await unwrapSession ( storage . config . getCookie ( 'foo' ) ! , encryptionKey ) ) . toEqual ( { } ) ;
91
+ const cookie = await storage . config . getCookie ( 'foo' ) ;
92
+ expect ( await unwrapSession ( cookie ?? '' , encryptionKey ) ) . toEqual ( { } ) ;
89
93
} ) ;
90
94
} ) ;
91
95
@@ -137,7 +141,8 @@ describe('CookieStorage concurrency', () => {
137
141
} ;
138
142
expect ( storage . data ) . toEqual ( result ) ;
139
143
140
- const unwrapped = await unwrapSession ( storage . config . getCookie ( 'logtoCookies' ) ! , encryptionKey ) ;
144
+ const cookie = await storage . config . getCookie ( 'logtoCookies' ) ;
145
+ const unwrapped = await unwrapSession ( cookie ?? '' , encryptionKey ) ;
141
146
142
147
if ( StorageClass === NoQueueTestCookieStorage ) {
143
148
expect ( unwrapped ) . not . toEqual ( result ) ;
0 commit comments