@@ -46,7 +46,7 @@ async function buildTestApp(mockRedis: MockRedis): Promise<FastifyInstance> {
4646 // in app.ts so that both Authorization header and token cookie are accepted.
4747 await app . register ( jwtPlugin as any , {
4848 secret : TEST_JWT_SECRET ,
49- cookie : { cookieName : 'token ' , signed : false } ,
49+ cookie : { cookieName : 'access_Token ' , signed : false } ,
5050 } ) ;
5151
5252 // Minimal Prisma stub. The logout route does not touch the database, but
@@ -264,7 +264,7 @@ describe('DELETE /auth/logout', () => {
264264 const res = await app . inject ( {
265265 method : 'DELETE' ,
266266 url : '/auth/logout' ,
267- headers : { Cookie : `token =${ token } ` } ,
267+ headers : { Cookie : `access_Token =${ token } ` } ,
268268 } ) ;
269269
270270 expect ( res . statusCode ) . toBe ( 200 ) ;
@@ -284,7 +284,7 @@ describe('DELETE /auth/logout', () => {
284284 url : '/auth/logout' ,
285285 headers : {
286286 Authorization : `Bearer ${ headerToken } ` ,
287- Cookie : `token =${ cookieToken } ` ,
287+ Cookie : `access_Token =${ cookieToken } ` ,
288288 } ,
289289 } ) ;
290290
@@ -309,7 +309,7 @@ describe('DELETE /auth/logout', () => {
309309 const raw = res . headers [ 'set-cookie' ] as string | string [ ] ;
310310 const cookieStr = Array . isArray ( raw ) ? raw . join ( '; ' ) : ( raw ?? '' ) ;
311311 // Value must be emptied.
312- expect ( cookieStr ) . toMatch ( / t o k e n = ; / ) ;
312+ expect ( cookieStr ) . toMatch ( / a c c e s s _ T o k e n = ; / ) ;
313313 // Path must be explicit so the browser clears the cookie on all routes.
314314 expect ( cookieStr ) . toMatch ( / P a t h = \/ / i) ;
315315 // Browser must be told to delete the cookie immediately.
@@ -350,7 +350,7 @@ describe('DELETE /auth/logout', () => {
350350 expect ( mockRedis . set ) . not . toHaveBeenCalled ( ) ;
351351 expect ( warnMock ) . toHaveBeenCalledOnce ( ) ;
352352 // Verify the message identifies the root cause clearly.
353- const [ , message ] = warnMock . mock . calls [ 0 ] as [ unknown , string ] ;
353+ const [ message ] = warnMock . mock . calls [ 0 ] as [ string ] ;
354354 expect ( message ) . toMatch ( / m i s s i n g e x p / i) ;
355355 } ) ;
356356
@@ -471,7 +471,7 @@ describe('authenticate middleware', () => {
471471 const res = await app . inject ( {
472472 method : 'GET' ,
473473 url : '/protected' ,
474- headers : { Cookie : `token =${ token } ` } ,
474+ headers : { Cookie : `access_Token =${ token } ` } ,
475475 } ) ;
476476
477477 expect ( res . statusCode ) . toBe ( 200 ) ;
@@ -574,7 +574,7 @@ describe('revocation flow — end-to-end', () => {
574574 const logout = await app . inject ( {
575575 method : 'DELETE' ,
576576 url : '/auth/logout' ,
577- headers : { Cookie : `token =${ token } ` } ,
577+ headers : { Cookie : `access_Token =${ token } ` } ,
578578 } ) ;
579579 expect ( logout . statusCode ) . toBe ( 200 ) ;
580580 expect ( mockRedis . set ) . toHaveBeenCalledOnce ( ) ;
@@ -588,7 +588,7 @@ describe('revocation flow — end-to-end', () => {
588588 const after = await app . inject ( {
589589 method : 'GET' ,
590590 url : '/protected' ,
591- headers : { Cookie : `token =${ token } ` } ,
591+ headers : { Cookie : `access_Token =${ token } ` } ,
592592 } ) ;
593593 expect ( after . statusCode ) . toBe ( 401 ) ;
594594 expect ( after . json ( ) . error ) . toBe ( 'Token has been revoked' ) ;
@@ -637,14 +637,14 @@ describe('extractRawJwt', () => {
637637 } ) ;
638638
639639 it ( 'returns token from cookie when no Authorization header' , ( ) => {
640- const req = makeRequest ( { cookies : { token : 'cookie.jwt.token' } } ) ;
640+ const req = makeRequest ( { cookies : { access_Token : 'cookie.jwt.token' } } ) ;
641641 expect ( extractRawJwt ( req ) ) . toBe ( 'cookie.jwt.token' ) ;
642642 } ) ;
643643
644644 it ( 'prefers Authorization header over cookie' , ( ) => {
645645 const req = makeRequest ( {
646646 authorization : 'Bearer header.jwt.token' ,
647- cookies : { token : 'cookie.jwt.token' } ,
647+ cookies : { access_Token : 'cookie.jwt.token' } ,
648648 } ) ;
649649 expect ( extractRawJwt ( req ) ) . toBe ( 'header.jwt.token' ) ;
650650 } ) ;
@@ -666,7 +666,7 @@ describe('extractRawJwt', () => {
666666 } ) ;
667667
668668 it ( 'returns null when the token cookie value is empty' , ( ) => {
669- const req = makeRequest ( { cookies : { token : '' } } ) ;
669+ const req = makeRequest ( { cookies : { access_Token : '' } } ) ;
670670 // || null normalises the empty string to null, matching the return type.
671671 expect ( extractRawJwt ( req ) ) . toBeNull ( ) ;
672672 } ) ;
0 commit comments