@@ -64,8 +64,7 @@ describe("Command Execution Timeout Integration", () => {
6464 } )
6565
6666 it ( "should pass timeout configuration to executeCommand" , async ( ) => {
67- const customTimeoutSeconds = 15
68- const customTimeout = customTimeoutSeconds * 1000 // Convert to milliseconds for internal use
67+ const customTimeout = 15000
6968 const options : ExecuteCommandOptions = {
7069 executionId : "test-execution" ,
7170 command : "echo test" ,
@@ -83,8 +82,7 @@ describe("Command Execution Timeout Integration", () => {
8382 } )
8483
8584 it ( "should handle timeout scenario" , async ( ) => {
86- const shortTimeoutSeconds = 0.1 // Very short timeout in seconds
87- const shortTimeout = shortTimeoutSeconds * 1000 // Convert to milliseconds
85+ const shortTimeout = 100 // Very short timeout
8886 const options : ExecuteCommandOptions = {
8987 executionId : "test-execution" ,
9088 command : "sleep 10" ,
@@ -106,13 +104,12 @@ describe("Command Execution Timeout Integration", () => {
106104
107105 // Should return timeout error
108106 expect ( result [ 0 ] ) . toBe ( false ) // Not rejected by user
109- expect ( result [ 1 ] ) . toContain ( "timed out " )
110- expect ( result [ 1 ] ) . toContain ( `${ shortTimeoutSeconds } s ` )
107+ expect ( result [ 1 ] ) . toContain ( "terminated after exceeding " )
108+ expect ( result [ 1 ] ) . toContain ( `${ shortTimeout } ms ` )
111109 } , 10000 ) // Increase test timeout to 10 seconds
112110
113111 it ( "should abort process on timeout" , async ( ) => {
114- const shortTimeoutSeconds = 0.05
115- const shortTimeout = shortTimeoutSeconds * 1000
112+ const shortTimeout = 50
116113 const options : ExecuteCommandOptions = {
117114 executionId : "test-execution" ,
118115 command : "sleep 10" ,
@@ -135,11 +132,10 @@ describe("Command Execution Timeout Integration", () => {
135132 } , 5000 ) // Increase test timeout to 5 seconds
136133
137134 it ( "should clean up timeout on successful completion" , async ( ) => {
138- const timeoutSeconds = 5
139135 const options : ExecuteCommandOptions = {
140136 executionId : "test-execution" ,
141137 command : "echo test" ,
142- commandExecutionTimeout : timeoutSeconds * 1000 ,
138+ commandExecutionTimeout : 5000 ,
143139 }
144140
145141 // Mock a process that completes quickly
@@ -150,7 +146,7 @@ describe("Command Execution Timeout Integration", () => {
150146
151147 // Should complete successfully without timeout
152148 expect ( result [ 0 ] ) . toBe ( false ) // Not rejected
153- expect ( result [ 1 ] ) . not . toContain ( "timed out " )
149+ expect ( result [ 1 ] ) . not . toContain ( "terminated after exceeding " )
154150 } )
155151
156152 it ( "should use default timeout when not specified (0 = no timeout)" , async ( ) => {
@@ -187,6 +183,6 @@ describe("Command Execution Timeout Integration", () => {
187183
188184 // Should complete successfully without timeout
189185 expect ( result [ 0 ] ) . toBe ( false ) // Not rejected
190- expect ( result [ 1 ] ) . not . toContain ( "timed out " )
186+ expect ( result [ 1 ] ) . not . toContain ( "terminated after exceeding " )
191187 } )
192188} )
0 commit comments