Skip to content

Commit dacc2d4

Browse files
test(tools): add comprehensive unit tests for AskFollowupQuestionTool (#212)
* test(tools): add comprehensive unit tests for AskFollowupQuestionTool - Add 36 unit tests covering execute(), handlePartial(), and error paths - Fix undefined text handling: use safeText = text ?? "" to prevent literal 'undefined' in user_message output - Add NativeToolCallParser integration tests for streaming ask_followup_question tool calls - Address review feedback: fix undefined assertion and improve empty string comment clarity * fix(tests): address roomote review - guard against undefined in pushToolResult and nest NativeToolCallParser tests - Add assertion verifying pushToolResult argument does not contain 'undefined' - Move NativeToolCallParser integration tests into main describe block for better organization * test(askFollowupQuestion): drop test subsumed by the comprehensive undefined-text case --------- Co-authored-by: Armando Vaquera <263793884+proyectoauraorg@users.noreply.github.com>
1 parent 59b035f commit dacc2d4

2 files changed

Lines changed: 401 additions & 195 deletions

File tree

src/core/tools/AskFollowupQuestionTool.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ export class AskFollowupQuestionTool extends BaseTool<"ask_followup_question"> {
4747

4848
task.consecutiveMistakeCount = 0
4949
const { text, images } = await task.ask("followup", JSON.stringify(follow_up_json), false)
50-
await task.say("user_feedback", text ?? "", images)
51-
pushToolResult(formatResponse.toolResult(`<user_message>\n${text}\n</user_message>`, images))
50+
const safeText = text ?? ""
51+
await task.say("user_feedback", safeText, images)
52+
pushToolResult(formatResponse.toolResult(`<user_message>\n${safeText}\n</user_message>`, images))
5253
} catch (error) {
5354
await handleError("asking question", error as Error)
5455
}

0 commit comments

Comments
 (0)