summaryrefslogtreecommitdiff
path: root/packages/core/src/tools/edit.test.ts
diff options
context:
space:
mode:
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