@@ -156,13 +156,16 @@ describe("check-env-var-count", () => {
156156 expect ( ( ) => main ( [ "--base" , "HEAD" ] , root ) ) . toThrow ( / e x c e e d s b u d g e t | o v e r b u d g e t / u) ;
157157 } ) ;
158158
159- it ( "allows only the owner-approved 502 to 503 budget increase" , ( ) => {
159+ it . each ( [
160+ [ 501 , 502 ] ,
161+ [ 502 , 503 ] ,
162+ ] ) ( "allows only the owner-approved %i to %i budget increase" , ( baseBudget , nextBudget ) => {
160163 const root = tempDirs . make ( "openclaw-env-count-approved-grow-" ) ;
161164 fs . mkdirSync ( path . join ( root , "config" ) , { recursive : true } ) ;
162165 fs . mkdirSync ( path . join ( root , "src" ) , { recursive : true } ) ;
163- const names = Array . from ( { length : 504 } , ( _ , index ) => `OPENCLAW_TEST_${ index } ` ) ;
164- fs . writeFileSync ( path . join ( root , "config/env-var-count-budget.txt" ) , "502\n" ) ;
165- fs . writeFileSync ( path . join ( root , "src/runtime.ts" ) , names . slice ( 0 , 502 ) . join ( "\n" ) ) ;
166+ const names = Array . from ( { length : nextBudget + 1 } , ( _ , index ) => `OPENCLAW_TEST_${ index } ` ) ;
167+ fs . writeFileSync ( path . join ( root , "config/env-var-count-budget.txt" ) , ` ${ baseBudget } \n` ) ;
168+ fs . writeFileSync ( path . join ( root , "src/runtime.ts" ) , names . slice ( 0 , baseBudget ) . join ( "\n" ) ) ;
166169 execFileSync ( "git" , [ "init" ] , { cwd : root , stdio : "ignore" } ) ;
167170 execFileSync ( "git" , [ "add" , "." ] , { cwd : root , stdio : "ignore" } ) ;
168171 execFileSync (
@@ -171,12 +174,12 @@ describe("check-env-var-count", () => {
171174 { cwd : root , stdio : "ignore" } ,
172175 ) ;
173176
174- fs . writeFileSync ( path . join ( root , "src/runtime.ts" ) , names . slice ( 0 , 503 ) . join ( "\n" ) ) ;
175- fs . writeFileSync ( path . join ( root , "config/env-var-count-budget.txt" ) , "503\n" ) ;
177+ fs . writeFileSync ( path . join ( root , "src/runtime.ts" ) , names . slice ( 0 , nextBudget ) . join ( "\n" ) ) ;
178+ fs . writeFileSync ( path . join ( root , "config/env-var-count-budget.txt" ) , ` ${ nextBudget } \n` ) ;
176179 expect ( ( ) => main ( [ "--base" , "HEAD" ] , root ) ) . not . toThrow ( ) ;
177180
178181 fs . writeFileSync ( path . join ( root , "src/runtime.ts" ) , names . join ( "\n" ) ) ;
179- fs . writeFileSync ( path . join ( root , "config/env-var-count-budget.txt" ) , "504\n" ) ;
182+ fs . writeFileSync ( path . join ( root , "config/env-var-count-budget.txt" ) , ` ${ nextBudget + 1 } \n` ) ;
180183 expect ( ( ) => main ( [ "--base" , "HEAD" ] , root ) ) . toThrow ( / b u d g e t g r e w / u) ;
181184 } ) ;
182185
0 commit comments