From 6e24ba20cc67f54c690bae59819156cf01b6865c Mon Sep 17 00:00:00 2001 From: Andrew Beal Date: Fri, 30 Jan 2026 22:10:11 +0000 Subject: [PATCH] refactor: remove unused import and redundant test cases Remove unused AIFunctionResponse import from BaseAgent and delete non-contentEditable element warning tests that are no longer needed --- Services/AIServices/BaseAgent.ts | 1 - __tests__/Services/InputService.test.ts | 37 ------------------------- 2 files changed, 38 deletions(-) diff --git a/Services/AIServices/BaseAgent.ts b/Services/AIServices/BaseAgent.ts index c51221e..93b2e45 100644 --- a/Services/AIServices/BaseAgent.ts +++ b/Services/AIServices/BaseAgent.ts @@ -1,5 +1,4 @@ import type { AIFunctionCall } from "AIClasses/AIFunctionCall"; -import { AIFunctionResponse } from "AIClasses/FunctionDefinitions/AIFunctionResponse"; import type { IAIClass } from "AIClasses/IAIClass"; import type { IPrompt } from "AIPrompts/IPrompt"; import type { Conversation } from "Conversations/Conversation"; diff --git a/__tests__/Services/InputService.test.ts b/__tests__/Services/InputService.test.ts index 2fba39e..7338ba4 100644 --- a/__tests__/Services/InputService.test.ts +++ b/__tests__/Services/InputService.test.ts @@ -515,18 +515,6 @@ describe('InputService', () => { service.insertTextAtCursor('Test', element); expect(element.textContent).toBe(originalText); }); - - it('should warn and not insert for non-contentEditable element', () => { - const nonEditable = document.createElement('div'); - nonEditable.textContent = 'Not editable'; - document.body.appendChild(nonEditable); - - const consoleSpy = vi.spyOn(console, 'warn'); - service.insertTextAtCursor('Test', nonEditable); - - expect(consoleSpy).toHaveBeenCalledWith('Element must be contenteditable'); - document.body.removeChild(nonEditable); - }); }); describe('insertElementAtCursor', () => { @@ -579,19 +567,6 @@ describe('InputService', () => { service.insertElementAtCursor(span, element); expect(element.childNodes.length).toBe(childrenBefore); }); - - it('should warn and not insert for non-contentEditable element', () => { - const nonEditable = document.createElement('div'); - nonEditable.textContent = 'Not editable'; - document.body.appendChild(nonEditable); - - const consoleSpy = vi.spyOn(console, 'warn'); - const span = document.createElement('span'); - service.insertElementAtCursor(span, nonEditable); - - expect(consoleSpy).toHaveBeenCalledWith('Element must be contenteditable'); - document.body.removeChild(nonEditable); - }); }); describe('deleteTextRange', () => { @@ -632,18 +607,6 @@ describe('InputService', () => { expect(element.textContent).toBe('Hello ld'); }); - it('should warn for non-contentEditable element', () => { - const nonEditable = document.createElement('div'); - nonEditable.textContent = 'Not editable'; - document.body.appendChild(nonEditable); - - const consoleSpy = vi.spyOn(console, 'warn'); - service.deleteTextRange(0, 3, nonEditable); - - expect(consoleSpy).toHaveBeenCalledWith('Element must be contenteditable'); - expect(nonEditable.textContent).toBe('Not editable'); // Unchanged - document.body.removeChild(nonEditable); - }); it('should handle invalid range gracefully', () => { const originalText = element.textContent;