@@ -122,14 +122,46 @@ describe('renderQuotaTable', () => {
122122 const output = lines . join ( '\n' ) ;
123123
124124 expect ( output ) . toContain ( '通用' ) ;
125- expect ( output ) . toContain ( '剩余 [█████████.] 94 %' ) ;
126- expect ( output ) . toContain ( '周剩余 [██████████] 98 %' ) ;
125+ expect ( output ) . toContain ( '剩余 [█████████.] 94.00 %' ) ;
126+ expect ( output ) . toContain ( '周剩余 [██████████] 98.00 %' ) ;
127127 expect ( output ) . toContain ( '视频' ) ;
128128 expect ( output ) . toContain ( '3 / 3' ) ;
129129 expect ( output ) . toContain ( '21 / 21' ) ;
130130 expect ( output ) . not . toContain ( '0 / 3' ) ;
131131 } ) ;
132132
133+ it ( 'preserves fractional remaining percentages in compact bars' , ( ) => {
134+ const lines : string [ ] = [ ] ;
135+ const originalLog = console . log ;
136+
137+ console . log = ( message ?: unknown ) => {
138+ lines . push ( String ( message ?? '' ) ) ;
139+ } ;
140+
141+ try {
142+ renderQuotaTable (
143+ [
144+ {
145+ ...createModel ( ) ,
146+ current_interval_total_count : 0 ,
147+ current_interval_usage_count : 0 ,
148+ current_interval_remaining_percent : 85.58 ,
149+ current_weekly_total_count : 0 ,
150+ current_weekly_usage_count : 0 ,
151+ current_weekly_remaining_percent : 97.01 ,
152+ } ,
153+ ] ,
154+ { ...createConfig ( ) , noColor : true } ,
155+ ) ;
156+ } finally {
157+ console . log = originalLog ;
158+ }
159+
160+ const output = lines . join ( '\n' ) ;
161+ expect ( output ) . toContain ( 'Left [█████████.] 85.58%' ) ;
162+ expect ( output ) . toContain ( 'Wk left [██████████] 97.01%' ) ;
163+ } ) ;
164+
133165 it ( 'uses remaining percent to disambiguate newer used-count responses' , ( ) => {
134166 const lines : string [ ] = [ ] ;
135167 const originalLog = console . log ;
@@ -190,7 +222,7 @@ describe('renderQuotaTable', () => {
190222 }
191223
192224 const output = lines . join ( '\n' ) ;
193- expect ( output ) . toContain ( 'Left [████......] 40 %' ) ;
225+ expect ( output ) . toContain ( 'Left [████......] 40.00 %' ) ;
194226 expect ( output ) . not . toContain ( '7 / 10' ) ;
195227 expect ( output ) . not . toContain ( '3 / 10' ) ;
196228 } ) ;
@@ -281,7 +313,7 @@ describe('renderQuotaTable', () => {
281313 }
282314
283315 const output = lines . join ( '\n' ) ;
284- expect ( output ) . toContain ( 'Wk left [██████████] 150%' ) ;
316+ expect ( output ) . toContain ( 'Wk left [██████████] 150.00 %' ) ;
285317 } ) ;
286318
287319 it ( 'clamps boosted weekly percent at MAX_DISPLAY_PCT (200)' , ( ) => {
@@ -310,7 +342,7 @@ describe('renderQuotaTable', () => {
310342 }
311343
312344 const output = lines . join ( '\n' ) ;
313- expect ( output ) . toContain ( '200%' ) ;
345+ expect ( output ) . toContain ( '200.00 %' ) ;
314346 expect ( output ) . not . toContain ( '300%' ) ;
315347 } ) ;
316348
0 commit comments