mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 20:20:57 +00:00
Update edit tool validation function to override validateToolParams (#667)
This commit is contained in:
parent
9dae07784b
commit
edc12e416d
2 changed files with 8 additions and 6 deletions
|
|
@ -178,14 +178,14 @@ describe('EditTool', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('validateParams', () => {
|
||||
describe('validateToolParams', () => {
|
||||
it('should return null for valid params', () => {
|
||||
const params: EditToolParams = {
|
||||
file_path: path.join(rootDir, 'test.txt'),
|
||||
old_string: 'old',
|
||||
new_string: 'new',
|
||||
};
|
||||
expect(tool.validateParams(params)).toBeNull();
|
||||
expect(tool.validateToolParams(params)).toBeNull();
|
||||
});
|
||||
|
||||
it('should return error for relative path', () => {
|
||||
|
|
@ -194,7 +194,9 @@ describe('EditTool', () => {
|
|||
old_string: 'old',
|
||||
new_string: 'new',
|
||||
};
|
||||
expect(tool.validateParams(params)).toMatch(/File path must be absolute/);
|
||||
expect(tool.validateToolParams(params)).toMatch(
|
||||
/File path must be absolute/,
|
||||
);
|
||||
});
|
||||
|
||||
it('should return error for path outside root', () => {
|
||||
|
|
@ -203,7 +205,7 @@ describe('EditTool', () => {
|
|||
old_string: 'old',
|
||||
new_string: 'new',
|
||||
};
|
||||
expect(tool.validateParams(params)).toMatch(
|
||||
expect(tool.validateToolParams(params)).toMatch(
|
||||
/File path must be within the root directory/,
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue