@@ -13,48 +13,33 @@ suite("Roo Code Modes", () => {
1313 */
1414
1515 const switchModesPrompt =
16- "For each mode (Code, Architect, Ask) respond with the mode name and what it specializes in after switching to that mode. " +
17- "Do not start with the current mode."
16+ "For each mode (Architect, Ask, Debug) respond with the mode name and what it specializes in after switching to that mode."
1817
1918 let messages : ClineMessage [ ] = [ ]
2019
20+ const modeSwitches : string [ ] = [ ]
21+
22+ api . on ( "taskModeSwitched" , ( _taskId , mode ) => {
23+ console . log ( "taskModeSwitched" , mode )
24+ modeSwitches . push ( mode )
25+ } )
26+
2127 api . on ( "message" , ( { message } ) => {
2228 if ( message . type === "say" && message . partial === false ) {
2329 messages . push ( message )
2430 }
2531 } )
2632
2733 const switchModesTaskId = await api . startNewTask ( {
28- configuration : { mode : "Code " , alwaysAllowModeSwitch : true , autoApprovalEnabled : true } ,
34+ configuration : { mode : "code " , alwaysAllowModeSwitch : true , autoApprovalEnabled : true } ,
2935 text : switchModesPrompt ,
3036 } )
3137
32- await waitUntilCompleted ( { api, taskId : switchModesTaskId , timeout : 60_000 } )
33-
34- /**
35- * Grade the response.
36- */
37-
38- const response = messages
39- . filter ( ( { type, say, partial } ) => say === "text" )
40- . map ( ( { text } ) => text ?? "" )
41- . join ( "\n" )
42-
43- const gradePrompt = `Given this prompt: ${ switchModesPrompt } grade the response from 1 to 10 in the format of "Grade: (1-10)". For example: Grade 7\n\nResponse: ${ response } `
44-
45- messages = [ ]
46-
47- const gradeTaskId = await api . startNewTask ( { configuration : { mode : "Ask" } , text : gradePrompt } )
48- await waitUntilCompleted ( { api, taskId : gradeTaskId } )
49-
50- const completion = messages . find ( ( { type, say, partial } ) => say === "completion_result" )
51- const match = completion ?. text ?. match ( / G r a d e : ( \d + ) / )
52- const score = parseInt ( match ?. [ 1 ] ?? "0" )
53- assert . ok (
54- score >= 7 && score <= 10 ,
55- `Grade must be between 7 and 10. DEBUG: score = ${ score } , completion = ${ completion ?. text } ` ,
56- )
57-
38+ await waitUntilCompleted ( { api, taskId : switchModesTaskId } )
5839 await api . cancelCurrentTask ( )
40+
41+ assert . ok ( modeSwitches . includes ( "architect" ) )
42+ assert . ok ( modeSwitches . includes ( "ask" ) )
43+ assert . ok ( modeSwitches . includes ( "debug" ) )
5944 } )
6045} )
0 commit comments