summaryrefslogtreecommitdiff
path: root/packages/core/src/tools/edit.test.ts
diff options
context:
space:
mode:
authorjoshualitt <[email protected]>2025-08-19 13:55:06 -0700
committerGitHub <[email protected]>2025-08-19 20:55:06 +0000
commitb9cece767d1abccd06fb95cab759afd06cc2c1e1 (patch)
tree8c29a49bbaedd0a706bd2dba82eb4c587797ba7e /packages/core/src/tools/edit.test.ts
parent2143731f6efdf1aafff38ec249caf01a8bcd163e (diff)
feat(core): Cleanup after migrating tools. (#6199)
Co-authored-by: Jacob Richman <[email protected]>
Diffstat (limited to 'packages/core/src/tools/edit.test.ts')
-rw-r--r--packages/core/src/tools/edit.test.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/packages/core/src/tools/edit.test.ts b/packages/core/src/tools/edit.test.ts
index 539ae3ef..10da7cd3 100644
--- a/packages/core/src/tools/edit.test.ts
+++ b/packages/core/src/tools/edit.test.ts
@@ -395,7 +395,7 @@ describe('EditTool', () => {
});
});
- it('should throw error if params are invalid', async () => {
+ it('should throw error if file path is not absolute', async () => {
const params: EditToolParams = {
file_path: 'relative.txt',
old_string: 'old',
@@ -404,6 +404,17 @@ describe('EditTool', () => {
expect(() => tool.build(params)).toThrow(/File path must be absolute/);
});
+ it('should throw error if file path is empty', async () => {
+ const params: EditToolParams = {
+ file_path: '',
+ old_string: 'old',
+ new_string: 'new',
+ };
+ expect(() => tool.build(params)).toThrow(
+ /The 'file_path' parameter must be non-empty./,
+ );
+ });
+
it('should edit an existing file and return diff with fileName', async () => {
const initialContent = 'This is some old text.';
const newContent = 'This is some new text.'; // old -> new