@@ -67,11 +67,6 @@ test.describe('auth() with API keys @nextjs', () => {
6767
6868 // No API key provided
6969 const noKeyRes = await fetch ( url ) ;
70- if ( noKeyRes . status !== 401 ) {
71- console . log ( 'Unexpected status for "noKeyRes". Status:' , noKeyRes . status , noKeyRes . statusText ) ;
72- const body = await noKeyRes . text ( ) ;
73- console . log ( `error body ${ body } error body` ) ;
74- }
7570 expect ( noKeyRes . status ) . toBe ( 401 ) ;
7671
7772 // Invalid API key
@@ -114,7 +109,7 @@ test.describe('auth() with API keys @nextjs', () => {
114109 const sessionData = await postWithSessionRes . json ( ) ;
115110 expect ( postWithSessionRes . status ( ) ) . toBe ( 200 ) ;
116111 expect ( sessionData . userId ) . toBe ( fakeBapiUser . id ) ;
117- expect ( sessionData . tokenType ) . toBe ( TokenType . ApiKey ) ;
112+ expect ( sessionData . tokenType ) . toBe ( TokenType . SessionToken ) ;
118113
119114 // Test with API key
120115 const postWithApiKeyRes = await fetch ( url , {
@@ -183,12 +178,12 @@ test.describe('auth.protect() with API keys @nextjs', () => {
183178 // expect(noKeyRes.status).toBe(401);
184179
185180 // // Invalid API key
186- // const invalidKeyRes = await fetch(url, {
187- // headers: {
188- // Authorization: 'Bearer invalid_key',
189- // },
190- // });
191- // expect(invalidKeyRes.status).toBe(401);
181+ const invalidKeyRes = await fetch ( url , {
182+ headers : {
183+ Authorization : 'Bearer invalid_key' ,
184+ } ,
185+ } ) ;
186+ expect ( invalidKeyRes . status ) . toBe ( 401 ) ;
192187
193188 // Valid API key
194189 const validKeyRes = await fetch ( url , {
@@ -222,7 +217,7 @@ test.describe('auth.protect() with API keys @nextjs', () => {
222217 const sessionData = await postWithSessionRes . json ( ) ;
223218 expect ( postWithSessionRes . status ( ) ) . toBe ( 200 ) ;
224219 expect ( sessionData . userId ) . toBe ( fakeBapiUser . id ) ;
225- expect ( sessionData . tokenType ) . toBe ( TokenType . ApiKey ) ;
220+ expect ( sessionData . tokenType ) . toBe ( TokenType . SessionToken ) ;
226221
227222 // Test with API key
228223 const postWithApiKeyRes = await fetch ( url , {
0 commit comments