@@ -12,8 +12,6 @@ import {
1212} from '@amzn/codewhisperer-streaming'
1313import { QDeveloperStreaming } from '@amzn/amazon-q-developer-streaming-client'
1414import { rejects } from 'assert'
15- import { initBaseTestServiceManager , TestAmazonQServiceManager } from './amazonQServiceManager/testUtils'
16- import { stubCodeWhispererService } from './testUtils'
1715
1816const TIME_TO_ADVANCE_MS = 100
1917
@@ -115,33 +113,6 @@ describe('StreamingClientServiceToken', () => {
115113 sinon . assert . match ( sendMessageStub . firstCall . firstArg , expectedRequest )
116114 } )
117115
118- it ( 'creates client with shareCodeWhispererContentWithAWS parameter' , ( ) => {
119- const streamingClientServiceWithOptout = new StreamingClientServiceToken (
120- features . credentialsProvider ,
121- features . sdkInitializator ,
122- features . logging ,
123- DEFAULT_AWS_Q_REGION ,
124- DEFAULT_AWS_Q_ENDPOINT_URL ,
125- 'some-user-agent'
126- )
127- streamingClientServiceWithOptout . shareCodeWhispererContentWithAWS = false
128-
129- expect ( streamingClientServiceWithOptout [ 'shareCodeWhispererContentWithAWS' ] ) . to . equal ( false )
130- } )
131-
132- it ( 'creates client without shareCodeWhispererContentWithAWS parameter' , ( ) => {
133- const streamingClientServiceDefault = new StreamingClientServiceToken (
134- features . credentialsProvider ,
135- features . sdkInitializator ,
136- features . logging ,
137- DEFAULT_AWS_Q_REGION ,
138- DEFAULT_AWS_Q_ENDPOINT_URL ,
139- 'some-user-agent'
140- )
141-
142- expect ( streamingClientServiceDefault [ 'shareCodeWhispererContentWithAWS' ] ) . to . be . undefined
143- } )
144-
145116 describe ( 'generateAssistantResponse' , ( ) => {
146117 const MOCKED_GENERATE_RESPONSE_REQUEST = {
147118 conversationState : {
@@ -347,79 +318,4 @@ describe('StreamingClientServiceIAM', () => {
347318 expect ( credentials . expiration ) . to . be . instanceOf ( Date )
348319 expect ( credentials . expiration . getTime ( ) ) . to . be . closeTo ( Date . now ( ) , 1000 )
349320 } )
350-
351- it ( 'creates client with shareCodeWhispererContentWithAWS parameter' , ( ) => {
352- const streamingClientServiceWithOptout = new StreamingClientServiceIAM (
353- features . credentialsProvider ,
354- features . sdkInitializator ,
355- features . logging ,
356- DEFAULT_AWS_Q_REGION ,
357- DEFAULT_AWS_Q_ENDPOINT_URL
358- )
359- streamingClientServiceWithOptout . shareCodeWhispererContentWithAWS = false
360-
361- expect ( streamingClientServiceWithOptout [ 'shareCodeWhispererContentWithAWS' ] ) . to . equal ( false )
362- } )
363-
364- it ( 'creates client without shareCodeWhispererContentWithAWS parameter' , ( ) => {
365- const streamingClientServiceDefault = new StreamingClientServiceIAM (
366- features . credentialsProvider ,
367- features . sdkInitializator ,
368- features . logging ,
369- DEFAULT_AWS_Q_REGION ,
370- DEFAULT_AWS_Q_ENDPOINT_URL
371- )
372-
373- expect ( streamingClientServiceDefault [ 'shareCodeWhispererContentWithAWS' ] ) . to . be . undefined
374- } )
375- } )
376-
377- describe ( 'BaseAmazonQServiceManager streaming client cache updates' , ( ) => {
378- let features : TestFeatures
379- let serviceManager : TestAmazonQServiceManager
380- let streamingClientMock : StreamingClientServiceToken
381-
382- beforeEach ( ( ) => {
383- features = new TestFeatures ( )
384- const serviceStub = stubCodeWhispererService ( )
385-
386- streamingClientMock = Object . assign ( sinon . createStubInstance ( StreamingClientServiceToken ) , {
387- region : DEFAULT_AWS_Q_REGION ,
388- endpoint : DEFAULT_AWS_Q_ENDPOINT_URL ,
389- } ) as unknown as StreamingClientServiceToken
390- serviceManager = initBaseTestServiceManager ( features , serviceStub , streamingClientMock )
391- } )
392-
393- afterEach ( ( ) => {
394- sinon . restore ( )
395- TestAmazonQServiceManager . resetInstance ( )
396- } )
397-
398- it ( 'updates shareCodeWhispererContentWithAWS on cached streaming client when configuration changes' , async ( ) => {
399- // Set initial configuration
400- features . lsp . workspace . getConfiguration . resolves ( { shareCodeWhispererContentWithAWS : true } )
401-
402- await serviceManager . handleDidChangeConfiguration ( )
403-
404- expect ( streamingClientMock . shareCodeWhispererContentWithAWS ) . to . equal ( true )
405-
406- // Change configuration
407- features . lsp . workspace . getConfiguration . resolves ( { shareCodeWhispererContentWithAWS : false } )
408-
409- await serviceManager . handleDidChangeConfiguration ( )
410-
411- expect ( streamingClientMock . shareCodeWhispererContentWithAWS ) . to . equal ( false )
412- } )
413-
414- it ( 'does not update streaming client when no cached client exists' , async ( ) => {
415- TestAmazonQServiceManager . resetInstance ( )
416- const serviceManagerWithoutClient = initBaseTestServiceManager ( features , stubCodeWhispererService ( ) )
417-
418- features . lsp . workspace . getConfiguration . resolves ( { shareCodeWhispererContentWithAWS : false } )
419-
420- // Should not throw when no cached streaming client exists
421- await serviceManagerWithoutClient . handleDidChangeConfiguration ( )
422-
423- expect ( serviceManagerWithoutClient [ 'cachedStreamingClient' ] ) . to . be . undefined
424- } )
425321} )
0 commit comments