1- // npx jest src/core /__tests__/CodeActionProvider.test.ts
1+ // npx jest src/activate /__tests__/CodeActionProvider.test.ts
22
33import * as vscode from "vscode"
44
5- import { EditorUtils } from "../EditorUtils"
5+ import { EditorUtils } from "../../integrations/editor/ EditorUtils"
66
77import { CodeActionProvider , ACTION_TITLES } from "../CodeActionProvider"
88
9- // Mock VSCode API
109jest . mock ( "vscode" , ( ) => ( {
1110 CodeAction : jest . fn ( ) . mockImplementation ( ( title , kind ) => ( {
1211 title,
@@ -29,8 +28,7 @@ jest.mock("vscode", () => ({
2928 } ,
3029} ) )
3130
32- // Mock EditorUtils
33- jest . mock ( "../EditorUtils" , ( ) => ( {
31+ jest . mock ( "../../core/editor/EditorUtils" , ( ) => ( {
3432 EditorUtils : {
3533 getEffectiveRange : jest . fn ( ) ,
3634 getFilePath : jest . fn ( ) ,
@@ -48,23 +46,16 @@ describe("CodeActionProvider", () => {
4846 beforeEach ( ( ) => {
4947 provider = new CodeActionProvider ( )
5048
51- // Mock document
5249 mockDocument = {
5350 getText : jest . fn ( ) ,
5451 lineAt : jest . fn ( ) ,
5552 lineCount : 10 ,
5653 uri : { fsPath : "/test/file.ts" } ,
5754 }
5855
59- // Mock range
6056 mockRange = new vscode . Range ( 0 , 0 , 0 , 10 )
6157
62- // Mock context
63- mockContext = {
64- diagnostics : [ ] ,
65- }
66-
67- // Setup default EditorUtils mocks
58+ mockContext = { diagnostics : [ ] }
6859 ; ( EditorUtils . getEffectiveRange as jest . Mock ) . mockReturnValue ( {
6960 range : mockRange ,
7061 text : "test code" ,
@@ -106,6 +97,7 @@ describe("CodeActionProvider", () => {
10697
10798 it ( "should handle errors gracefully" , ( ) => {
10899 const consoleErrorSpy = jest . spyOn ( console , "error" ) . mockImplementation ( ( ) => { } )
100+
109101 ; ( EditorUtils . getEffectiveRange as jest . Mock ) . mockImplementation ( ( ) => {
110102 throw new Error ( "Test error" )
111103 } )
0 commit comments