mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Improve Function Call argument validation and typing (#2881)
Co-authored-by: N. Taylor Mullen <ntaylormullen@google.com>
This commit is contained in:
committed by
GitHub
parent
137ffec3f6
commit
4dab31f1c8
@@ -73,8 +73,8 @@ describe('ReadFileTool', () => {
|
||||
|
||||
it('should return error for relative path', () => {
|
||||
const params: ReadFileToolParams = { absolute_path: 'test.txt' };
|
||||
expect(tool.validateToolParams(params)).toMatch(
|
||||
/File path must be absolute/,
|
||||
expect(tool.validateToolParams(params)).toBe(
|
||||
`params/absolute_path must match pattern "^/"`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -119,7 +119,7 @@ describe('ReadFileTool', () => {
|
||||
it('should return error for schema validation failure (e.g. missing path)', () => {
|
||||
const params = { offset: 0 } as unknown as ReadFileToolParams;
|
||||
expect(tool.validateToolParams(params)).toBe(
|
||||
'Parameters failed schema validation.',
|
||||
`params must have required property 'absolute_path'`,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -143,8 +143,12 @@ describe('ReadFileTool', () => {
|
||||
it('should return validation error if params are invalid', async () => {
|
||||
const params: ReadFileToolParams = { absolute_path: 'relative/path.txt' };
|
||||
const result = await tool.execute(params, abortSignal);
|
||||
expect(result.llmContent).toMatch(/Error: Invalid parameters provided/);
|
||||
expect(result.returnDisplay).toMatch(/File path must be absolute/);
|
||||
expect(result.llmContent).toBe(
|
||||
'Error: Invalid parameters provided. Reason: params/absolute_path must match pattern "^/"',
|
||||
);
|
||||
expect(result.returnDisplay).toBe(
|
||||
'params/absolute_path must match pattern "^/"',
|
||||
);
|
||||
});
|
||||
|
||||
it('should return error from processSingleFileContent if it fails', async () => {
|
||||
|
||||
Reference in New Issue
Block a user