@@ -17,6 +17,8 @@ describe('InlineCompletionManager', () => {
1717 let executeCommandStub : sinon . SinonStub
1818 let disposableStub : sinon . SinonStub
1919 let sandbox : sinon . SinonSandbox
20+ let getActiveSessionStub : sinon . SinonStub
21+ let getActiveRecommendationStub : sinon . SinonStub
2022
2123 beforeEach ( ( ) => {
2224 sandbox = sinon . createSandbox ( )
@@ -38,6 +40,8 @@ describe('InlineCompletionManager', () => {
3840 } as unknown as LanguageClient
3941
4042 manager = new InlineCompletionManager ( languageClient )
43+ getActiveSessionStub = sandbox . stub ( manager [ 'sessionManager' ] , 'getActiveSession' )
44+ getActiveRecommendationStub = sandbox . stub ( manager [ 'sessionManager' ] , 'getActiveRecommendation' )
4145 } )
4246
4347 afterEach ( ( ) => {
@@ -70,7 +74,7 @@ describe('InlineCompletionManager', () => {
7074
7175 it ( 'should register accept and reject commands' , ( ) => {
7276 assert ( registerCommandStub . calledWith ( 'aws.amazonq.acceptInline' ) )
73- assert ( registerCommandStub . calledWith ( 'aws.amazonq.rejectInline ' ) )
77+ assert ( registerCommandStub . calledWith ( 'aws.amazonq.rejectCodeSuggestion ' ) )
7478 } )
7579
7680 describe ( 'onInlineAcceptance' , ( ) => {
@@ -114,12 +118,23 @@ describe('InlineCompletionManager', () => {
114118 // Get the rejection handler
115119 const rejectionHandler = registerCommandStub
116120 . getCalls ( )
117- . find ( ( call ) => call . args [ 0 ] === 'aws.amazonq.rejectInline ' ) ?. args [ 1 ]
121+ . find ( ( call ) => call . args [ 0 ] === 'aws.amazonq.rejectCodeSuggestion ' ) ?. args [ 1 ]
118122
119123 const sessionId = 'test-session'
120124 const itemId = 'test-item'
125+ const mockSuggestion = {
126+ itemId,
127+ insertText : 'test' ,
128+ }
121129
122- await rejectionHandler ( sessionId , itemId )
130+ getActiveSessionStub . returns ( {
131+ sessionId : 'test-session' ,
132+ suggestions : [ mockSuggestion ] ,
133+ isRequestInProgress : false ,
134+ requestStartTime : Date . now ( ) ,
135+ } )
136+ getActiveRecommendationStub . returns ( [ mockSuggestion ] )
137+ await rejectionHandler ( )
123138
124139 assert ( executeCommandStub . calledWith ( 'editor.action.inlineSuggest.hide' ) )
125140 assert ( sendNotificationStub . calledOnce )
0 commit comments