@@ -283,13 +283,19 @@ Deno.test("FetchClientProvider - useRateLimit enables rate limiting", async () =
283283 const client = provider . getFetchClient ( ) ;
284284
285285 // First two requests should succeed
286- const response1 = await client . getJSON ( "/api/data" , { expectedStatusCodes : [ 429 ] } ) ;
287- const response2 = await client . getJSON ( "/api/data" , { expectedStatusCodes : [ 429 ] } ) ;
286+ const response1 = await client . getJSON ( "/api/data" , {
287+ expectedStatusCodes : [ 429 ] ,
288+ } ) ;
289+ const response2 = await client . getJSON ( "/api/data" , {
290+ expectedStatusCodes : [ 429 ] ,
291+ } ) ;
288292 assertEquals ( response1 . status , 200 ) ;
289293 assertEquals ( response2 . status , 200 ) ;
290294
291295 // Third request should be rate limited
292- const response3 = await client . getJSON ( "/api/data" , { expectedStatusCodes : [ 429 ] } ) ;
296+ const response3 = await client . getJSON ( "/api/data" , {
297+ expectedStatusCodes : [ 429 ] ,
298+ } ) ;
293299 assertEquals ( response3 . status , 429 ) ;
294300
295301 mocks . restore ( ) ;
@@ -313,7 +319,9 @@ Deno.test("FetchClientProvider - removeRateLimit disables rate limiting", async
313319 await client . getJSON ( "/api/data" , { expectedStatusCodes : [ 429 ] } ) ;
314320
315321 // Second would be rate limited
316- const response2 = await client . getJSON ( "/api/data" , { expectedStatusCodes : [ 429 ] } ) ;
322+ const response2 = await client . getJSON ( "/api/data" , {
323+ expectedStatusCodes : [ 429 ] ,
324+ } ) ;
317325 assertEquals ( response2 . status , 429 ) ;
318326
319327 // Remove rate limiting
@@ -351,7 +359,9 @@ Deno.test("FetchClientProvider - useCircuitBreaker enables circuit breaker", asy
351359 assertEquals ( provider . circuitBreaker ! . getState ( "/api/data" ) , "OPEN" ) ;
352360
353361 // Next request should return 503 without hitting the API
354- const response = await client . getJSON ( "/api/data" , { expectedStatusCodes : [ 503 ] } ) ;
362+ const response = await client . getJSON ( "/api/data" , {
363+ expectedStatusCodes : [ 503 ] ,
364+ } ) ;
355365 assertEquals ( response . status , 503 ) ;
356366 assertEquals ( mocks . history . get . length , 2 ) ; // Only 2 requests made
357367
@@ -381,7 +391,9 @@ Deno.test("FetchClientProvider - removeCircuitBreaker disables circuit breaker",
381391
382392 // Now requests should go through (need new client)
383393 const client2 = provider . getFetchClient ( ) ;
384- const response = await client2 . getJSON ( "/api/data" , { expectedStatusCodes : [ 500 ] } ) ;
394+ const response = await client2 . getJSON ( "/api/data" , {
395+ expectedStatusCodes : [ 500 ] ,
396+ } ) ;
385397 assertEquals ( response . status , 500 ) ; // Actual response, not 503
386398
387399 mocks . restore ( ) ;
@@ -466,15 +478,21 @@ Deno.test("FetchClientProvider - usePerDomainRateLimit groups by domain", async
466478 const client = provider . getFetchClient ( ) ;
467479
468480 // First request to domain1 succeeds
469- const r1 = await client . getJSON ( "https://domain1.com/api/data" , { expectedStatusCodes : [ 429 ] } ) ;
481+ const r1 = await client . getJSON ( "https://domain1.com/api/data" , {
482+ expectedStatusCodes : [ 429 ] ,
483+ } ) ;
470484 assertEquals ( r1 . status , 200 ) ;
471485
472486 // Second request to domain1 is rate limited
473- const r2 = await client . getJSON ( "https://domain1.com/api/other" , { expectedStatusCodes : [ 429 ] } ) ;
487+ const r2 = await client . getJSON ( "https://domain1.com/api/other" , {
488+ expectedStatusCodes : [ 429 ] ,
489+ } ) ;
474490 assertEquals ( r2 . status , 429 ) ;
475491
476492 // First request to domain2 succeeds (different domain)
477- const r3 = await client . getJSON ( "https://domain2.com/api/data" , { expectedStatusCodes : [ 429 ] } ) ;
493+ const r3 = await client . getJSON ( "https://domain2.com/api/data" , {
494+ expectedStatusCodes : [ 429 ] ,
495+ } ) ;
478496 assertEquals ( r3 . status , 200 ) ;
479497
480498 mocks . restore ( ) ;
@@ -495,10 +513,14 @@ Deno.test("FetchClientProvider - usePerDomainCircuitBreaker isolates domains", a
495513 const client = provider . getFetchClient ( ) ;
496514
497515 // Fail on failing.com to open its circuit
498- await client . getJSON ( "https://failing.com/api" , { expectedStatusCodes : [ 500 , 503 ] } ) ;
516+ await client . getJSON ( "https://failing.com/api" , {
517+ expectedStatusCodes : [ 500 , 503 ] ,
518+ } ) ;
499519
500520 // failing.com circuit is open
501- const r1 = await client . getJSON ( "https://failing.com/api" , { expectedStatusCodes : [ 503 ] } ) ;
521+ const r1 = await client . getJSON ( "https://failing.com/api" , {
522+ expectedStatusCodes : [ 503 ] ,
523+ } ) ;
502524 assertEquals ( r1 . status , 503 ) ;
503525
504526 // working.com should still work (separate circuit)
0 commit comments