@@ -34,21 +34,26 @@ describe("usageLimitRecoveryBannerItem", () => {
3434 ) ;
3535 } ) ;
3636
37- it ( "shows the provider capacity message and keeps the reset recovery actions" , ( ) => {
38- const message =
39- "Upstream request failed: [ttft_admission_refused] the cell is at capacity; retry shortly (after 30 s)" ;
40- const item = usageLimitRecoveryBannerItem ( {
41- runId : RunId . make ( "run-capacity" ) ,
42- resetAt : new Date ( stoppedAt . getTime ( ) + 30_000 ) . toISOString ( ) ,
43- stoppedAt : stoppedAt . toISOString ( ) ,
44- snoozedUntil : null ,
45- recovery : null ,
46- timestampFormat : "24-hour" ,
47- failure : { class : "usage_limit" , code : "provider.rate-limit" , message } ,
48- onChange : async ( ) => { } ,
49- } ) ;
37+ it . each ( [ null , new Date ( 2026 , 9 , 20 , 17 , 30 ) ] ) (
38+ "shows provider capacity detail with the reported reset %s" ,
39+ ( resetAt ) => {
40+ using _now = vi . spyOn ( Date , "now" ) . mockReturnValue ( stoppedAt . getTime ( ) ) ;
41+ const message =
42+ "Upstream request failed: [ttft_admission_refused] the cell is at capacity; retry shortly (after 30 s)" ;
43+ const item = usageLimitRecoveryBannerItem ( {
44+ runId : RunId . make ( "run-capacity" ) ,
45+ resetAt : resetAt ?. toISOString ( ) ?? null ,
46+ stoppedAt : stoppedAt . toISOString ( ) ,
47+ snoozedUntil : null ,
48+ recovery : null ,
49+ timestampFormat : "24-hour" ,
50+ failure : { class : "usage_limit" , code : "provider.rate-limit" , message } ,
51+ onChange : async ( ) => { } ,
52+ } ) ;
5053
51- expect ( item . description ) . toBe ( message ) ;
52- expect ( item . actions ) . not . toBeNull ( ) ;
53- } ) ;
54+ expect ( item . description ) . toBe ( resetAt ? `${ message } Resets 17:30.` : message ) ;
55+ if ( resetAt ) expect ( item . actions ) . not . toBeNull ( ) ;
56+ else expect ( item . actions ) . toBeNull ( ) ;
57+ } ,
58+ ) ;
5459} ) ;
0 commit comments