Skip to content

Commit 7e7b6c2

Browse files
committed
Fix unit tests
1 parent 6747bca commit 7e7b6c2

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

packages/amazonq/src/extensionNode.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,19 @@ import * as vscode from 'vscode'
77
import { activateAmazonQCommon, amazonQContextPrefix, deactivateCommon } from './extension'
88
import { DefaultAmazonQAppInitContext } from 'aws-core-vscode/amazonq'
99
import { activate as activateQGumby } from 'aws-core-vscode/amazonqGumby'
10-
import {
11-
ExtContext,
12-
globals,
13-
CrashMonitoring,
14-
getLogger,
15-
isNetworkError,
16-
isSageMaker,
17-
Experiments,
18-
} from 'aws-core-vscode/shared'
10+
import { ExtContext, globals, CrashMonitoring, Experiments } from 'aws-core-vscode/shared'
1911
import { filetypes, SchemaService } from 'aws-core-vscode/sharedNode'
2012
import { updateDevMode } from 'aws-core-vscode/dev'
2113
import { CommonAuthViewProvider } from 'aws-core-vscode/login'
2214
import { isExtensionActive, VSCODE_EXTENSION_ID } from 'aws-core-vscode/utils'
2315
import { registerSubmitFeedback } from 'aws-core-vscode/feedback'
2416
import { DevOptions } from 'aws-core-vscode/dev'
25-
import { Auth, AuthUtils, getTelemetryMetadataForConn, isAnySsoConnection } from 'aws-core-vscode/auth'
17+
import { Auth } from 'aws-core-vscode/auth'
2618
import api from './api'
2719
import { activate as activateCWChat } from './app/chat/activation'
2820
import { activate as activateInlineChat } from './inlineChat/activation'
2921
import { beta } from 'aws-core-vscode/dev'
30-
import { activate as activateNotifications, NotificationsController } from 'aws-core-vscode/notifications'
31-
import { AuthState, AuthUtil } from 'aws-core-vscode/codewhisperer'
32-
import { telemetry, AuthUserState } from 'aws-core-vscode/telemetry'
22+
import { NotificationsController } from 'aws-core-vscode/notifications'
3323

3424
export async function activate(context: vscode.ExtensionContext) {
3525
// IMPORTANT: No other code should be added to this function. Place it in one of the following 2 functions where appropriate.

packages/amazonq/test/unit/codewhisperer/service/inlineCompletionService.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ describe('codewhisperer status bar', function () {
203203
})
204204

205205
it('shows correct status bar when auth is not connected', async function () {
206-
sandbox.stub(AuthUtil.instance, 'isConnectionValid').returns(false)
206+
sandbox.stub(AuthUtil.instance, 'isConnected').returns(false)
207207
sandbox.stub(AuthUtil.instance, 'isConnectionExpired').returns(false)
208208

209209
await service.refreshStatusBar()
@@ -215,7 +215,7 @@ describe('codewhisperer status bar', function () {
215215
})
216216

217217
it('shows correct status bar when auth is connected', async function () {
218-
sandbox.stub(AuthUtil.instance, 'isConnectionValid').returns(true)
218+
sandbox.stub(AuthUtil.instance, 'isConnected').returns(true)
219219
sandbox.stub(CodeSuggestionsState.instance, 'isSuggestionsEnabled').returns(true)
220220

221221
await service.refreshStatusBar()
@@ -227,7 +227,7 @@ describe('codewhisperer status bar', function () {
227227
})
228228

229229
it('shows correct status bar when auth is connected but paused', async function () {
230-
sandbox.stub(AuthUtil.instance, 'isConnectionValid').returns(true)
230+
sandbox.stub(AuthUtil.instance, 'isConnected').returns(true)
231231
sandbox.stub(CodeSuggestionsState.instance, 'isSuggestionsEnabled').returns(false)
232232

233233
await service.refreshStatusBar()
@@ -239,7 +239,7 @@ describe('codewhisperer status bar', function () {
239239
})
240240

241241
it('shows correct status bar when auth is expired', async function () {
242-
sandbox.stub(AuthUtil.instance, 'isConnectionValid').returns(false)
242+
sandbox.stub(AuthUtil.instance, 'isConnected').returns(false)
243243
sandbox.stub(AuthUtil.instance, 'isConnectionExpired').returns(true)
244244

245245
await service.refreshStatusBar()

packages/amazonq/test/unit/codewhisperer/tracker/codewhispererTracker.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe('codewhispererTracker', function () {
8383
describe('emitTelemetryOnSuggestion', function () {
8484
it('Should call recordCodewhispererUserModification with suggestion event', async function () {
8585
const testStartUrl = 'testStartUrl'
86-
sinon.stub(AuthUtil.instance, 'startUrl').value(testStartUrl)
86+
sinon.stub(AuthUtil.instance.connection, 'startUrl').value(testStartUrl)
8787
const suggestion = createAcceptedSuggestionEntry()
8888
const assertTelemetry = assertTelemetryCurried('codewhisperer_userModification')
8989
await CodeWhispererTracker.getTracker().emitTelemetryOnSuggestion(suggestion)

0 commit comments

Comments
 (0)