@@ -35,6 +35,56 @@ describe("AutoApprovalHandler", () => {
3535 expect ( mockAskForApproval ) . not . toHaveBeenCalled ( )
3636 } )
3737
38+ // kilocode_change start: yolo mode
39+ it ( "should bypass all checks when YOLO mode is enabled" , async ( ) => {
40+ mockState . yoloMode = true
41+ mockState . allowedMaxRequests = 1
42+ mockState . allowedMaxCost = 0.01
43+
44+ const messages : ClineMessage [ ] = [ ]
45+ // Add messages that would normally exceed limits
46+ for ( let i = 0 ; i < 10 ; i ++ ) {
47+ messages . push ( { type : "say" , say : "api_req_started" , text : "{}" , ts : 1000 + i } )
48+ }
49+
50+ mockGetApiMetrics . mockReturnValue ( { totalCost : 100.0 } )
51+
52+ const result = await handler . checkAutoApprovalLimits ( mockState , messages , mockAskForApproval )
53+
54+ expect ( result . shouldProceed ) . toBe ( true )
55+ expect ( result . requiresApproval ) . toBe ( false )
56+ expect ( mockAskForApproval ) . not . toHaveBeenCalled ( )
57+ expect ( mockGetApiMetrics ) . not . toHaveBeenCalled ( )
58+ } )
59+
60+ it ( "should bypass request limits when YOLO mode is enabled" , async ( ) => {
61+ mockState . yoloMode = true
62+ mockState . allowedMaxRequests = 0
63+
64+ const messages : ClineMessage [ ] = [ ]
65+ const result = await handler . checkAutoApprovalLimits ( mockState , messages , mockAskForApproval )
66+
67+ expect ( result . shouldProceed ) . toBe ( true )
68+ expect ( result . requiresApproval ) . toBe ( false )
69+ expect ( mockAskForApproval ) . not . toHaveBeenCalled ( )
70+ } )
71+
72+ it ( "should bypass cost limits when YOLO mode is enabled" , async ( ) => {
73+ mockState . yoloMode = true
74+ mockState . allowedMaxCost = 0
75+
76+ const messages : ClineMessage [ ] = [ ]
77+ mockGetApiMetrics . mockReturnValue ( { totalCost : 1000.0 } )
78+
79+ const result = await handler . checkAutoApprovalLimits ( mockState , messages , mockAskForApproval )
80+
81+ expect ( result . shouldProceed ) . toBe ( true )
82+ expect ( result . requiresApproval ) . toBe ( false )
83+ expect ( mockAskForApproval ) . not . toHaveBeenCalled ( )
84+ expect ( mockGetApiMetrics ) . not . toHaveBeenCalled ( )
85+ } )
86+ // kilocode_change end
87+
3888 it ( "should check request limit before cost limit" , async ( ) => {
3989 mockState . allowedMaxRequests = 1
4090 mockState . allowedMaxCost = 10
0 commit comments