@@ -60,6 +60,7 @@ describe('Copilot Methods API Route', () => {
6060 vi . doMock ( '@/lib/env' , ( ) => ( {
6161 env : {
6262 INTERNAL_API_SECRET : 'test-secret-key' ,
63+ COPILOT_API_KEY : 'test-copilot-key' ,
6364 } ,
6465 } ) )
6566
@@ -123,17 +124,16 @@ describe('Copilot Methods API Route', () => {
123124
124125 expect ( response . status ) . toBe ( 401 )
125126 const responseData = await response . json ( )
126- expect ( responseData ) . toEqual ( {
127- success : false ,
128- error : 'Invalid API key' ,
129- } )
127+ expect ( responseData . success ) . toBe ( false )
128+ expect ( typeof responseData . error ) . toBe ( 'string' )
130129 } )
131130
132131 it ( 'should return 401 when internal API key is not configured' , async ( ) => {
133132 // Mock environment with no API key
134133 vi . doMock ( '@/lib/env' , ( ) => ( {
135134 env : {
136135 INTERNAL_API_SECRET : undefined ,
136+ COPILOT_API_KEY : 'test-copilot-key' ,
137137 } ,
138138 } ) )
139139
@@ -154,10 +154,9 @@ describe('Copilot Methods API Route', () => {
154154
155155 expect ( response . status ) . toBe ( 401 )
156156 const responseData = await response . json ( )
157- expect ( responseData ) . toEqual ( {
158- success : false ,
159- error : 'Internal API key not configured' ,
160- } )
157+ expect ( responseData . status ) . toBeUndefined ( )
158+ expect ( responseData . success ) . toBe ( false )
159+ expect ( typeof responseData . error ) . toBe ( 'string' )
161160 } )
162161
163162 it ( 'should return 400 for invalid request body - missing methodId' , async ( ) => {
0 commit comments