mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
36 lines
1 KiB
TypeScript
36 lines
1 KiB
TypeScript
import * as assert from "assert"
|
|
|
|
import { RooCodeEventName, type ClineMessage } from "@roo-code/types"
|
|
|
|
import { waitUntilCompleted } from "./utils"
|
|
import { setDefaultSuiteTimeout } from "./test-utils"
|
|
|
|
suite("Roo Code Task", function () {
|
|
setDefaultSuiteTimeout(this)
|
|
|
|
test("Should handle prompt and response correctly", async () => {
|
|
const api = globalThis.api
|
|
|
|
const messages: ClineMessage[] = []
|
|
|
|
api.on(RooCodeEventName.Message, ({ message }) => {
|
|
if (message.type === "say" && message.partial === false) {
|
|
messages.push(message)
|
|
}
|
|
})
|
|
|
|
const taskId = await api.startNewTask({
|
|
configuration: { mode: "ask", alwaysAllowModeSwitch: true, autoApprovalEnabled: true },
|
|
text: "Hello world, what is your name? Respond with 'My name is ...'",
|
|
})
|
|
|
|
await waitUntilCompleted({ api, taskId })
|
|
|
|
assert.ok(
|
|
!!messages.find(
|
|
({ say, text }) => (say === "completion_result" || say === "text") && text?.includes("My name is Roo"),
|
|
),
|
|
`Completion should include "My name is Roo"`,
|
|
)
|
|
})
|
|
})
|