Skip to content

Commit 34bde5e

Browse files
committed
Linting and export updates
1 parent 77ff327 commit 34bde5e

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

packages/amazonq/src/lsp/chat/messages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export function registerMessageListeners(
8181
}
8282
case AUTH_FOLLOW_UP_CLICKED: {
8383
languageClient.info('[VSCode Client] AuthFollowUp clicked')
84-
let authType = message.params.authFollowupType
84+
const authType = message.params.authFollowupType
8585
const reAuthTypes: AuthFollowUpType[] = ['re-auth', 'missing_scopes']
8686
const fullAuthTypes: AuthFollowUpType[] = ['full-auth', 'use-supported-auth']
8787

packages/amazonq/test/unit/amazonq/lsp/chat/messages.test.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
import * as sinon from 'sinon'
27
import { LanguageClient } from 'vscode-languageclient'
38
import { AuthUtil } from 'aws-core-vscode/codewhisperer'
49
import { registerMessageListeners } from '../../../../../src/lsp/chat/messages'
510
import { AmazonQChatViewProvider } from '../../../../../src/lsp/chat/webviewProvider'
6-
import { SecondaryAuth } from '../../../../../../core/dist/src/auth/secondaryAuth'
7-
import { Connection } from '../../../../../../core/dist/src/auth/connection'
11+
import { SecondaryAuth, Connection } from 'aws-core-vscode/amazonq'
812

913
describe('registerMessageListeners', () => {
1014
let languageClient: LanguageClient
1115
let provider: AmazonQChatViewProvider
1216
let sandbox: sinon.SinonSandbox
1317
let messageHandler: (message: any) => void | Promise<void>
18+
let errorStub: sinon.SinonStub
1419

1520
beforeEach(() => {
1621
sandbox = sinon.createSandbox()
22+
errorStub = sandbox.stub()
1723

1824
languageClient = {
1925
info: sandbox.stub(),
20-
error: sandbox.stub(),
26+
error: errorStub,
2127
sendNotification: sandbox.stub(),
2228
} as unknown as LanguageClient
2329

2430
provider = {
2531
webview: {
2632
onDidReceiveMessage: (callback: (message: any) => void | Promise<void>) => {
2733
messageHandler = callback
28-
return { dispose: () => {} }
34+
return {
35+
dispose: (): void => {},
36+
}
2937
},
3038
},
3139
} as any
@@ -90,8 +98,8 @@ describe('registerMessageListeners', () => {
9098
},
9199
})
92100

93-
sinon.assert.calledOnce(languageClient.error as sinon.SinonStub)
94-
sinon.assert.calledWith(languageClient.error as sinon.SinonStub, sinon.match(/Failed to re-authenticate/))
101+
sinon.assert.calledOnce(errorStub)
102+
sinon.assert.calledWith(errorStub, sinon.match(/Failed to re-authenticate/))
95103
})
96104

97105
it('should log error if full authentication fails', async () => {
@@ -104,8 +112,8 @@ describe('registerMessageListeners', () => {
104112
},
105113
})
106114

107-
sinon.assert.calledOnce(languageClient.error as sinon.SinonStub)
108-
sinon.assert.calledWith(languageClient.error as sinon.SinonStub, sinon.match(/Failed to authenticate/))
115+
sinon.assert.calledOnce(errorStub)
116+
sinon.assert.calledWith(errorStub, sinon.match(/Failed to authenticate/))
109117
})
110118
})
111119
})

packages/core/src/amazonq/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ export { extractAuthFollowUp } from './util/authUtils'
4646
export { Messenger } from './commons/connector/baseMessenger'
4747
export * from './lsp/config'
4848
export * as WorkspaceLspInstaller from './lsp/workspaceInstaller'
49+
export { SecondaryAuth } from '../auth/secondaryAuth'
50+
export { Connection } from '../auth/connection'
4951
import { FeatureContext } from '../shared/featureConfig'
5052

5153
/**

0 commit comments

Comments
 (0)