Skip to content

Commit 30aca0f

Browse files
committed
test: Update read_file tests to validate XML formatted results
This commit modifies the assertions in the `read_file` tool tests to check for the expected XML format in the results. The changes ensure that the output structure aligns with recent updates to the tool's response formatting, enhancing test accuracy and reliability.
1 parent 03f2236 commit 30aca0f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/core/__tests__/read-file-maxReadFileLine.test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ describe("read_file tool with maxReadFileLine setting", () => {
147147
expect(mockedExtractTextFromFile).toHaveBeenCalledWith(absoluteFilePath)
148148
expect(mockedReadLines).not.toHaveBeenCalled()
149149
expect(mockedParseSourceCodeDefinitionsForFile).not.toHaveBeenCalled()
150-
expect(result).toBe(numberedFileContent)
150+
expect(result).toBe(
151+
`<file>\n <path>${testFilePath}</path>\n <content>\n${numberedFileContent}\n </content>\n</file>`,
152+
)
151153
})
152154
})
153155

@@ -207,7 +209,9 @@ describe("read_file tool with maxReadFileLine setting", () => {
207209

208210
// Verify
209211
expect(mockedExtractTextFromFile).toHaveBeenCalledWith(absoluteFilePath)
210-
expect(result).toBe(numberedFileContent)
212+
expect(result).toBe(
213+
`<file>\n <path>${testFilePath}</path>\n <content>\n${numberedFileContent}\n </content>\n</file>`,
214+
)
211215
})
212216

213217
it("should read with extractTextFromFile when file has few lines", async () => {
@@ -221,7 +225,9 @@ describe("read_file tool with maxReadFileLine setting", () => {
221225
// Verify
222226
expect(mockedExtractTextFromFile).toHaveBeenCalledWith(absoluteFilePath)
223227
expect(mockedReadLines).not.toHaveBeenCalled()
224-
expect(result).toBe(numberedFileContent)
228+
expect(result).toBe(
229+
`<file>\n <path>${testFilePath}</path>\n <content>\n${numberedFileContent}\n </content>\n</file>`,
230+
)
225231
})
226232
})
227233

@@ -237,7 +243,9 @@ describe("read_file tool with maxReadFileLine setting", () => {
237243
// Verify
238244
expect(mockedExtractTextFromFile).toHaveBeenCalledWith(absoluteFilePath)
239245
expect(mockedReadLines).not.toHaveBeenCalled()
240-
expect(result).toBe(numberedFileContent)
246+
expect(result).toBe(
247+
`<file>\n <path>${testFilePath}</path>\n <content>\n${numberedFileContent}\n </content>\n</file>`,
248+
)
241249
})
242250
})
243251

0 commit comments

Comments
 (0)