@@ -10,6 +10,9 @@ import {
1010 DiffAnimationController ,
1111 PartialUpdateOptions ,
1212} from '../../../../../src/lsp/chat/diffAnimation/diffAnimationController'
13+ import { WebviewManager } from '../../../../../src/lsp/chat/diffAnimation/webviewManager'
14+ import { DiffAnalyzer } from '../../../../../src/lsp/chat/diffAnimation/diffAnalyzer'
15+ import { VSCodeIntegration } from '../../../../../src/lsp/chat/diffAnimation/vscodeIntegration'
1316
1417describe ( 'DiffAnimationController' , function ( ) {
1518 let controller : DiffAnimationController
@@ -87,6 +90,8 @@ describe('DiffAnimationController', function () {
8790 sandbox . stub ( vscode . window , 'showTextDocument' )
8891 sandbox . stub ( vscode . commands , 'executeCommand' )
8992 sandbox . stub ( vscode . window , 'setStatusBarMessage' )
93+ sandbox . stub ( vscode . window , 'createWebviewPanel' )
94+ sandbox . stub ( vscode . workspace , 'registerTextDocumentContentProvider' )
9095
9196 // Mock vscode.workspace.fs properly
9297 const mockFs = {
@@ -96,6 +101,42 @@ describe('DiffAnimationController', function () {
96101 }
97102 sandbox . stub ( vscode . workspace , 'fs' ) . value ( mockFs )
98103
104+ // Mock the component classes to prevent real instantiation
105+ const mockWebviewPanel = {
106+ reveal : sandbox . stub ( ) ,
107+ dispose : sandbox . stub ( ) ,
108+ onDidDispose : sandbox . stub ( ) . returns ( { dispose : sandbox . stub ( ) } ) ,
109+ webview : {
110+ html : '' ,
111+ onDidReceiveMessage : sandbox . stub ( ) . returns ( { dispose : sandbox . stub ( ) } ) ,
112+ postMessage : sandbox . stub ( ) . resolves ( ) ,
113+ } ,
114+ }
115+
116+ sandbox . stub ( WebviewManager . prototype , 'getOrCreateDiffWebview' ) . resolves ( mockWebviewPanel as any )
117+ sandbox . stub ( WebviewManager . prototype , 'sendMessageToWebview' ) . resolves ( )
118+ sandbox . stub ( WebviewManager . prototype , 'shouldAutoScrollForFile' ) . returns ( true )
119+ sandbox . stub ( WebviewManager . prototype , 'closeDiffWebview' )
120+ sandbox . stub ( WebviewManager . prototype , 'dispose' )
121+
122+ sandbox . stub ( DiffAnalyzer . prototype , 'calculateChangedRegion' ) . returns ( {
123+ startLine : 0 ,
124+ endLine : 5 ,
125+ totalLines : 10 ,
126+ } )
127+ sandbox . stub ( DiffAnalyzer . prototype , 'createScanPlan' ) . returns ( {
128+ leftLines : [ ] ,
129+ rightLines : [ ] ,
130+ scanPlan : [ ] ,
131+ } )
132+ sandbox . stub ( DiffAnalyzer . prototype , 'calculateAnimationTiming' ) . returns ( {
133+ scanDelay : 50 ,
134+ totalDuration : 1000 ,
135+ } )
136+
137+ sandbox . stub ( VSCodeIntegration . prototype , 'showVSCodeDiff' ) . resolves ( )
138+ sandbox . stub ( VSCodeIntegration . prototype , 'openFileInEditor' ) . resolves ( )
139+
99140 controller = new DiffAnimationController ( )
100141 } )
101142
0 commit comments