feat: Add SendMessage capability during Mode Switch

This commit is contained in:
Dennis Bartlett
2025-02-11 04:26:35 -06:00
parent 9c8254cf92
commit 9e76cfd44a
6 changed files with 42 additions and 5 deletions
+26 -1
View File
@@ -28,7 +28,13 @@ describe("Chat Integration Tests", () => {
vscode.postMessage({ type: 'newTask', text: message.text });
break;
case 'toggleMode':
vscode.postMessage({ type: 'chatSettings', chatSettings: { mode: 'act' } });
vscode.postMessage({
type: 'chatSettings',
chatSettings: { mode: 'act' },
chatContent: {
message: "message test",
}
});
break;
case 'invoke':
if (message.invoke === 'primaryButtonClick') {
@@ -92,6 +98,25 @@ describe("Chat Integration Tests", () => {
assert.equal(stateChange.chatSettings.mode, "act")
})
it("should toggle between plan and act modes with messages", async () => {
// Set up state change listener
const stateChangePromise = new Promise<any>((resolve) => {
panel.webview.onDidReceiveMessage((message) => {
if (message.type === "chatSettings") {
resolve(message)
}
})
})
// Trigger mode toggle
await panel.webview.postMessage({ type: "toggleMode" })
// Verify mode changed
const stateChange = await stateChangePromise
assert.equal(stateChange.chatSettings.mode, "act")
assert.equal(stateChange.chatContent.message, "message test")
})
it("should handle tool approval flow", async () => {
// Set up approval listener
const approvalPromise = new Promise<any>((resolve) => {