Update newTaskTool.test.ts to use specific directive types directly

This commit is contained in:
Steven T. Cramer 2025-06-16 13:10:17 +07:00
parent 2202273cc1
commit 2550e8528f

View file

@ -65,9 +65,9 @@ describe("newTaskTool", () => {
})
it("should correctly un-escape \\\\@ to \\@ in the message passed to the new task", async () => {
const block: ToolDirective = {
type: "tool_use", // Add required 'type' property
name: "new_task", // Correct property name
const block: NewTaskToolDirective = {
type: "tool_use",
name: "new_task",
params: {
mode: "code",
message: "Review this: \\\\@file1.txt and also \\\\\\\\@file2.txt", // Input with \\@ and \\\\@
@ -77,7 +77,7 @@ describe("newTaskTool", () => {
await newTaskTool(
mockCline as any, // Use 'as any' for simplicity in mocking complex type
block as NewTaskToolDirective,
block,
mockAskApproval, // Now correctly typed
mockHandleError,
mockPushToolResult,
@ -102,9 +102,9 @@ describe("newTaskTool", () => {
})
it("should not un-escape single escaped \@", async () => {
const block: ToolDirective = {
type: "tool_use", // Add required 'type' property
name: "new_task", // Correct property name
const block: NewTaskToolDirective = {
type: "tool_use",
name: "new_task",
params: {
mode: "code",
message: "This is already unescaped: \\@file1.txt",
@ -114,7 +114,7 @@ describe("newTaskTool", () => {
await newTaskTool(
mockCline as any,
block as NewTaskToolDirective,
block,
mockAskApproval, // Now correctly typed
mockHandleError,
mockPushToolResult,
@ -129,9 +129,9 @@ describe("newTaskTool", () => {
})
it("should not un-escape non-escaped @", async () => {
const block: ToolDirective = {
type: "tool_use", // Add required 'type' property
name: "new_task", // Correct property name
const block: NewTaskToolDirective = {
type: "tool_use",
name: "new_task",
params: {
mode: "code",
message: "A normal mention @file1.txt",
@ -141,7 +141,7 @@ describe("newTaskTool", () => {
await newTaskTool(
mockCline as any,
block as NewTaskToolDirective,
block,
mockAskApproval, // Now correctly typed
mockHandleError,
mockPushToolResult,
@ -156,9 +156,9 @@ describe("newTaskTool", () => {
})
it("should handle mixed escaping scenarios", async () => {
const block: ToolDirective = {
type: "tool_use", // Add required 'type' property
name: "new_task", // Correct property name
const block: NewTaskToolDirective = {
type: "tool_use",
name: "new_task",
params: {
mode: "code",
message: "Mix: @file0.txt, \\@file1.txt, \\\\@file2.txt, \\\\\\\\@file3.txt",
@ -168,7 +168,7 @@ describe("newTaskTool", () => {
await newTaskTool(
mockCline as any,
block as NewTaskToolDirective,
block,
mockAskApproval, // Now correctly typed
mockHandleError,
mockPushToolResult,