diff options
Diffstat (limited to 'packages/core/src/tools/read-file.test.ts')
| -rw-r--r-- | packages/core/src/tools/read-file.test.ts | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/packages/core/src/tools/read-file.test.ts b/packages/core/src/tools/read-file.test.ts index bb9317fd..8c11afab 100644 --- a/packages/core/src/tools/read-file.test.ts +++ b/packages/core/src/tools/read-file.test.ts @@ -222,7 +222,7 @@ describe('ReadFileTool', () => { }); }); - it('should pass offset and limit to read a slice of a text file', async () => { + it('should return a structured message when a slice of a text file is read', async () => { const filePath = path.join(tempRootDir, 'paginated.txt'); const fileContent = Array.from( { length: 20 }, @@ -240,15 +240,22 @@ describe('ReadFileTool', () => { ToolResult >; - expect(await invocation.execute(abortSignal)).toEqual({ - llmContent: [ - '[File content truncated: showing lines 6-8 of 20 total lines. Use offset/limit parameters to view more.]', - 'Line 6', - 'Line 7', - 'Line 8', - ].join('\n'), - returnDisplay: 'Read lines 6-8 of 20 from paginated.txt', - }); + const result = await invocation.execute(abortSignal); + + const expectedLlmContent = ` +IMPORTANT: The file content has been truncated. +Status: Showing lines 6-8 of 20 total lines. +Action: To read more of the file, you can use the 'offset' and 'limit' parameters in a subsequent 'read_file' call. For example, to read the next section of the file, use offset: 8. + +--- FILE CONTENT (truncated) --- +Line 6 +Line 7 +Line 8`; + + expect(result.llmContent).toEqual(expectedLlmContent); + expect(result.returnDisplay).toBe( + 'Read lines 6-8 of 20 from paginated.txt', + ); }); describe('with .geminiignore', () => { |
