Skip to content

Commit 899664a

Browse files
echobtfactorydroid
andauthored
fix(editor): resolve TypeScript errors in editor component tests (#353)
- Remove unused imports (waitFor, type) from RenameWidget.test.tsx - Remove unused import (waitFor) from FindReplaceWidget.test.tsx - Remove unused inputStyle variable in FindReplaceWidget.test.tsx - Add missing getScrolledVisiblePosition mock to createMockMonacoEditor These changes fix TypeScript compilation errors (TS6133) for unused variables and imports, and fix the missing mock property error (TS2339) in the test files. Co-authored-by: Droid Agent <droid@factory.ai>
1 parent c0a2cd2 commit 899664a

File tree

3 files changed

+1
-4
lines changed

3 files changed

+1
-4
lines changed

cortex-gui/src/components/editor/__tests__/FindReplaceWidget.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
fireEvent,
1212
createMockMonaco,
1313
createMockMonacoEditor,
14-
waitFor,
1514
nextTick,
1615
} from "@/test/utils";
1716
import { FindReplaceWidget, FindReplaceWidgetProps } from "../FindReplaceWidget";
@@ -360,7 +359,6 @@ describe("FindReplaceWidget", () => {
360359
await nextTick();
361360

362361
// Error styling may be applied
363-
const inputStyle = window.getComputedStyle(searchInput);
364362
// The input may have error styling
365363
expect(searchInput).toBeTruthy();
366364
}

cortex-gui/src/components/editor/__tests__/RenameWidget.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ import {
1111
fireEvent,
1212
createMockMonaco,
1313
createMockMonacoEditor,
14-
waitFor,
1514
nextTick,
16-
type,
1715
} from "@/test/utils";
1816
import {
1917
RenameWidget,

cortex-gui/src/test/setup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ export const createMockMonacoEditor = () => ({
157157
setScrollPosition: vi.fn(),
158158
getVisibleRanges: vi.fn().mockReturnValue([]),
159159
getTopForLineNumber: vi.fn().mockReturnValue(0),
160+
getScrolledVisiblePosition: vi.fn().mockReturnValue({ left: 100, top: 50, height: 20 }),
160161
getConfiguration: vi.fn().mockReturnValue({
161162
fontInfo: { fontSize: 14, lineHeight: 20 },
162163
}),

0 commit comments

Comments
 (0)