@@ -97,16 +97,16 @@ describe('debug utilities', () => {
9797
9898 debugApiResponse ( '/api/test' , undefined , error )
9999
100- expect ( debugDir ) . toHaveBeenCalledWith ( {
100+ expect ( mockDebugDirNs ) . toHaveBeenCalledWith ( 'error' , {
101101 endpoint : '/api/test' ,
102102 error : 'API failed' ,
103103 } )
104104 } )
105105
106- it ( 'logs warning for HTTP error status codes' , ( ) => {
106+ it ( 'logs under error namespace for HTTP error status codes' , ( ) => {
107107 debugApiResponse ( '/api/test' , 404 )
108108
109- expect ( debug ) . toHaveBeenCalledWith ( 'API /api/test: HTTP 404' )
109+ expect ( debugNs ) . toHaveBeenCalledWith ( 'error' , 'API /api/test: HTTP 404' )
110110 } )
111111
112112 it ( 'logs notice for successful responses when debug is enabled' , ( ) => {
@@ -128,7 +128,7 @@ describe('debug utilities', () => {
128128 it ( 'handles non-Error objects in error parameter' , ( ) => {
129129 debugApiResponse ( '/api/test' , undefined , 'String error' )
130130
131- expect ( debugDir ) . toHaveBeenCalledWith ( {
131+ expect ( mockDebugDirNs ) . toHaveBeenCalledWith ( 'error' , {
132132 endpoint : '/api/test' ,
133133 error : 'Unknown error' ,
134134 } )
@@ -148,7 +148,7 @@ describe('debug utilities', () => {
148148
149149 debugApiResponse ( '/api/test' , undefined , error , requestInfo )
150150
151- const calledWith = mockDebugDir . mock . calls [ 0 ] ?. [ 0 ]
151+ const calledWith = mockDebugDirNs . mock . calls [ 0 ] ?. [ 1 ] as any
152152 expect ( calledWith . method ) . toBe ( 'POST' )
153153 expect ( calledWith . url ) . toBe ( 'https://api.socket.dev/test' )
154154 expect ( calledWith . durationMs ) . toBe ( 1500 )
@@ -169,7 +169,7 @@ describe('debug utilities', () => {
169169
170170 debugApiResponse ( '/api/resource' , 500 , undefined , requestInfo )
171171
172- const calledWith = mockDebugDir . mock . calls [ 0 ] ?. [ 0 ]
172+ const calledWith = mockDebugDirNs . mock . calls [ 0 ] ?. [ 1 ] as any
173173 expect ( calledWith . status ) . toBe ( 500 )
174174 expect ( calledWith . method ) . toBe ( 'GET' )
175175 // API key should be redacted.
@@ -183,7 +183,7 @@ describe('debug utilities', () => {
183183
184184 debugApiResponse ( '/api/update' , 400 , undefined , requestInfo )
185185
186- const calledWith = mockDebugDir . mock . calls [ 0 ] ?. [ 0 ]
186+ const calledWith = mockDebugDirNs . mock . calls [ 0 ] ?. [ 1 ] as any
187187 expect ( calledWith . method ) . toBe ( 'PUT' )
188188 expect ( calledWith . url ) . toBeUndefined ( )
189189 expect ( calledWith . headers ) . toBeUndefined ( )
@@ -198,7 +198,7 @@ describe('debug utilities', () => {
198198
199199 debugApiResponse ( '/api/x' , 500 , undefined , requestInfo )
200200
201- const calledWith = mockDebugDir . mock . calls [ 0 ] ?. [ 0 ]
201+ const calledWith = mockDebugDirNs . mock . calls [ 0 ] ?. [ 1 ] as any
202202 expect ( calledWith . requestedAt ) . toBe ( '2026-04-18T00:00:00.000Z' )
203203 } )
204204
@@ -214,7 +214,7 @@ describe('debug utilities', () => {
214214
215215 debugApiResponse ( '/api/y' , 500 , undefined , requestInfo )
216216
217- const calledWith = mockDebugDir . mock . calls [ 0 ] ?. [ 0 ]
217+ const calledWith = mockDebugDirNs . mock . calls [ 0 ] ?. [ 1 ] as any
218218 expect ( calledWith . cfRay ) . toBe ( 'abc123-IAD' )
219219 expect ( calledWith . responseHeaders ?. [ 'cf-ray' ] ) . toBe ( 'abc123-IAD' )
220220 } )
@@ -230,7 +230,7 @@ describe('debug utilities', () => {
230230
231231 debugApiResponse ( '/api/z' , 500 , undefined , requestInfo )
232232
233- const calledWith = mockDebugDir . mock . calls [ 0 ] ?. [ 0 ]
233+ const calledWith = mockDebugDirNs . mock . calls [ 0 ] ?. [ 1 ] as any
234234 expect ( calledWith . cfRay ) . toBe ( 'xyz789-SJC' )
235235 } )
236236
@@ -243,7 +243,7 @@ describe('debug utilities', () => {
243243
244244 debugApiResponse ( '/api/body' , 400 , undefined , requestInfo )
245245
246- const calledWith = mockDebugDir . mock . calls [ 0 ] ?. [ 0 ]
246+ const calledWith = mockDebugDirNs . mock . calls [ 0 ] ?. [ 1 ] as any
247247 expect ( calledWith . responseBody ) . toBe ( '{"error":"bad"}' )
248248 } )
249249
@@ -257,7 +257,7 @@ describe('debug utilities', () => {
257257
258258 debugApiResponse ( '/api/big' , 500 , undefined , requestInfo )
259259
260- const calledWith = mockDebugDir . mock . calls [ 0 ] ?. [ 0 ]
260+ const calledWith = mockDebugDirNs . mock . calls [ 0 ] ?. [ 1 ] as any
261261 expect ( calledWith . responseBody ) . toMatch ( / … \( t r u n c a t e d , 5 0 0 0 c h a r s \) $ / )
262262 expect ( ( calledWith . responseBody as string ) . length ) . toBeLessThan (
263263 bigBody . length ,
0 commit comments