mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-17 05:20:23 -07:00
refactor(core): consolidate execute() arguments into ExecuteOptions (#25101)
This commit is contained in:
@@ -237,7 +237,7 @@ describe('ReadFileTool', () => {
|
||||
const params: ReadFileToolParams = { file_path: 'textfile.txt' };
|
||||
const invocation = tool.build(params);
|
||||
|
||||
expect(await invocation.execute(abortSignal)).toEqual({
|
||||
expect(await invocation.execute({ abortSignal })).toEqual({
|
||||
llmContent: fileContent,
|
||||
returnDisplay: '',
|
||||
});
|
||||
@@ -248,7 +248,7 @@ describe('ReadFileTool', () => {
|
||||
const params: ReadFileToolParams = { file_path: filePath };
|
||||
const invocation = tool.build(params);
|
||||
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
expect(result).toEqual({
|
||||
llmContent:
|
||||
'Could not read file because no file was found at the specified path.',
|
||||
@@ -267,7 +267,7 @@ describe('ReadFileTool', () => {
|
||||
const params: ReadFileToolParams = { file_path: filePath };
|
||||
const invocation = tool.build(params);
|
||||
|
||||
expect(await invocation.execute(abortSignal)).toEqual({
|
||||
expect(await invocation.execute({ abortSignal })).toEqual({
|
||||
llmContent: fileContent,
|
||||
returnDisplay: '',
|
||||
});
|
||||
@@ -279,7 +279,7 @@ describe('ReadFileTool', () => {
|
||||
const params: ReadFileToolParams = { file_path: dirPath };
|
||||
const invocation = tool.build(params);
|
||||
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
expect(result).toEqual({
|
||||
llmContent:
|
||||
'Could not read file because the provided path is a directory, not a file.',
|
||||
@@ -299,7 +299,7 @@ describe('ReadFileTool', () => {
|
||||
const params: ReadFileToolParams = { file_path: filePath };
|
||||
const invocation = tool.build(params);
|
||||
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
expect(result).toHaveProperty('error');
|
||||
expect(result.error?.type).toBe(ToolErrorType.FILE_TOO_LARGE);
|
||||
expect(result.error?.message).toContain(
|
||||
@@ -315,7 +315,7 @@ describe('ReadFileTool', () => {
|
||||
const params: ReadFileToolParams = { file_path: filePath };
|
||||
const invocation = tool.build(params);
|
||||
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
expect(result.llmContent).toContain(
|
||||
'IMPORTANT: The file content has been truncated',
|
||||
);
|
||||
@@ -333,7 +333,7 @@ describe('ReadFileTool', () => {
|
||||
const params: ReadFileToolParams = { file_path: imagePath };
|
||||
const invocation = tool.build(params);
|
||||
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
expect(result.llmContent).toEqual({
|
||||
inlineData: {
|
||||
data: pngHeader.toString('base64'),
|
||||
@@ -351,7 +351,7 @@ describe('ReadFileTool', () => {
|
||||
const params: ReadFileToolParams = { file_path: pdfPath };
|
||||
const invocation = tool.build(params);
|
||||
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
expect(result.llmContent).toEqual({
|
||||
inlineData: {
|
||||
data: pdfHeader.toString('base64'),
|
||||
@@ -369,7 +369,7 @@ describe('ReadFileTool', () => {
|
||||
const params: ReadFileToolParams = { file_path: binPath };
|
||||
const invocation = tool.build(params);
|
||||
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
expect(result.llmContent).toBe(
|
||||
'Cannot display content of binary file: binary.bin',
|
||||
);
|
||||
@@ -383,7 +383,7 @@ describe('ReadFileTool', () => {
|
||||
const params: ReadFileToolParams = { file_path: svgPath };
|
||||
const invocation = tool.build(params);
|
||||
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
expect(result.llmContent).toBe(svgContent);
|
||||
expect(result.returnDisplay).toBe('Read SVG as text: image.svg');
|
||||
});
|
||||
@@ -396,7 +396,7 @@ describe('ReadFileTool', () => {
|
||||
const params: ReadFileToolParams = { file_path: svgPath };
|
||||
const invocation = tool.build(params);
|
||||
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
expect(result.llmContent).toBe(
|
||||
'Cannot display content of SVG file larger than 1MB: large.svg',
|
||||
);
|
||||
@@ -411,7 +411,7 @@ describe('ReadFileTool', () => {
|
||||
const params: ReadFileToolParams = { file_path: emptyPath };
|
||||
const invocation = tool.build(params);
|
||||
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
expect(result.llmContent).toBe('');
|
||||
expect(result.returnDisplay).toBe('');
|
||||
});
|
||||
@@ -429,7 +429,7 @@ describe('ReadFileTool', () => {
|
||||
};
|
||||
const invocation = tool.build(params);
|
||||
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
expect(result.llmContent).toContain(
|
||||
'IMPORTANT: The file content has been truncated',
|
||||
);
|
||||
@@ -454,7 +454,7 @@ describe('ReadFileTool', () => {
|
||||
const params: ReadFileToolParams = { file_path: tempFilePath };
|
||||
const invocation = tool.build(params);
|
||||
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
expect(result.llmContent).toBe(tempFileContent);
|
||||
expect(result.returnDisplay).toBe('');
|
||||
});
|
||||
@@ -624,7 +624,7 @@ describe('ReadFileTool', () => {
|
||||
await fsp.writeFile(filePath, fileContent, 'utf-8');
|
||||
|
||||
const invocation = tool.build({ file_path: filePath });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
expect(discoverJitContext).toHaveBeenCalled();
|
||||
expect(result.llmContent).toContain('Newly Discovered Project Context');
|
||||
@@ -640,7 +640,7 @@ describe('ReadFileTool', () => {
|
||||
await fsp.writeFile(filePath, fileContent, 'utf-8');
|
||||
|
||||
const invocation = tool.build({ file_path: filePath });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
expect(result.llmContent).not.toContain(
|
||||
'Newly Discovered Project Context',
|
||||
@@ -666,7 +666,7 @@ describe('ReadFileTool', () => {
|
||||
await fsp.writeFile(filePath, pngHeader);
|
||||
|
||||
const invocation = tool.build({ file_path: filePath });
|
||||
const result = await invocation.execute(abortSignal);
|
||||
const result = await invocation.execute({ abortSignal });
|
||||
|
||||
expect(discoverJitContext).toHaveBeenCalled();
|
||||
// Result should be an array containing both the image part and JIT context
|
||||
|
||||
Reference in New Issue
Block a user