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.ts32
1 files changed, 17 insertions, 15 deletions
diff --git a/packages/core/src/tools/edit.test.ts b/packages/core/src/tools/edit.test.ts
index 1341fdd0..ab42450a 100644
--- a/packages/core/src/tools/edit.test.ts
+++ b/packages/core/src/tools/edit.test.ts
@@ -84,20 +84,22 @@ describe('EditTool', () => {
// Reset mocks and set default implementation for ensureCorrectEdit
mockEnsureCorrectEdit.mockReset();
- mockEnsureCorrectEdit.mockImplementation(async (currentContent, params) => {
- let occurrences = 0;
- if (params.old_string && currentContent) {
- // Simple string counting for the mock
- let index = currentContent.indexOf(params.old_string);
- while (index !== -1) {
- occurrences++;
- index = currentContent.indexOf(params.old_string, index + 1);
+ mockEnsureCorrectEdit.mockImplementation(
+ async (_, currentContent, params) => {
+ let occurrences = 0;
+ if (params.old_string && currentContent) {
+ // Simple string counting for the mock
+ let index = currentContent.indexOf(params.old_string);
+ while (index !== -1) {
+ occurrences++;
+ index = currentContent.indexOf(params.old_string, index + 1);
+ }
+ } else if (params.old_string === '') {
+ occurrences = 0; // Creating a new file
}
- } else if (params.old_string === '') {
- occurrences = 0; // Creating a new file
- }
- return Promise.resolve({ params, occurrences });
- });
+ return Promise.resolve({ params, occurrences });
+ },
+ );
// Default mock for generateJson to return the snippet unchanged
mockGenerateJson.mockReset();
@@ -333,7 +335,7 @@ describe('EditTool', () => {
// Set a specific mock for this test case
let mockCalled = false;
mockEnsureCorrectEdit.mockImplementationOnce(
- async (content, p, client) => {
+ async (_, content, p, client) => {
mockCalled = true;
expect(content).toBe(originalContent);
expect(p).toBe(params);
@@ -383,7 +385,7 @@ describe('EditTool', () => {
beforeEach(() => {
filePath = path.join(rootDir, testFile);
// Default for execute tests, can be overridden
- mockEnsureCorrectEdit.mockImplementation(async (content, params) => {
+ mockEnsureCorrectEdit.mockImplementation(async (_, content, params) => {
let occurrences = 0;
if (params.old_string && content) {
let index = content.indexOf(params.old_string);