Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/amazonq/test/unit/amazonq/backend_amazonq.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ describe('Amazon Q Login', async function () {
let sandbox: sinon.SinonSandbox
let backend: backendAmazonQ.AmazonQLoginWebview

await createTestAuthUtil()

beforeEach(function () {
beforeEach(async function () {
await createTestAuthUtil()
sandbox = sinon.createSandbox()
backend = new backendAmazonQ.AmazonQLoginWebview()
})
Expand Down Expand Up @@ -101,6 +100,8 @@ describe('Amazon Q Login', async function () {
})

it('signs out of reauth and emits telemetry', async function () {
await getStartUrl.connectToEnterpriseSso(startUrl, region)

await backend.signout()

assert.ok(!AuthUtil.instance.isConnected())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import assert from 'assert'
import * as sinon from 'sinon'
import { resetCodeWhispererGlobalVariables, createMockTextEditor } from 'aws-core-vscode/test'
import { resetCodeWhispererGlobalVariables, createMockTextEditor, createTestAuthUtil } from 'aws-core-vscode/test'
import {
ConfigurationEntry,
invokeRecommendation,
Expand All @@ -20,6 +20,7 @@ describe('invokeRecommendation', function () {
let mockClient: DefaultCodeWhispererClient

beforeEach(async function () {
await createTestAuthUtil()
await resetCodeWhispererGlobalVariables()
getRecommendationStub = sinon.stub(InlineCompletionService.instance, 'getPaginatedRecommendation')
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ describe('RegionProfileManager', async function () {
description: 'foo description',
}

await createTestAuthUtil()

async function setupConnection(type: 'builderId' | 'idc') {
if (type === 'builderId') {
await AuthUtil.instance.login(constants.builderIdStartUrl, region)
Expand All @@ -37,7 +35,8 @@ describe('RegionProfileManager', async function () {
}
}

beforeEach(function () {
beforeEach(async function () {
await createTestAuthUtil()
regionProfileManager = new RegionProfileManager(AuthUtil.instance)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ import {
listCodeWhispererCommandsId,
DefaultCodeWhispererClient,
} from 'aws-core-vscode/codewhisperer'
import { createMockTextEditor, resetCodeWhispererGlobalVariables, createMockDocument } from 'aws-core-vscode/test'
import {
createMockTextEditor,
resetCodeWhispererGlobalVariables,
createMockDocument,
createTestAuthUtil,
} from 'aws-core-vscode/test'

describe('inlineCompletionService', function () {
beforeEach(async function () {
Expand Down Expand Up @@ -192,6 +197,7 @@ describe('codewhisperer status bar', function () {
}

beforeEach(async function () {
await createTestAuthUtil()
await resetCodeWhispererGlobalVariables()
sandbox = sinon.createSandbox()
statusBar = new TestStatusBar()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as sinon from 'sinon'
import * as codewhispererSdkClient from 'aws-core-vscode/codewhisperer'
import {
createMockTextEditor,
createTestAuthUtil,
createTextDocumentChangeEvent,
resetCodeWhispererGlobalVariables,
} from 'aws-core-vscode/test'
Expand Down Expand Up @@ -160,13 +161,16 @@ describe('keyStrokeHandler', function () {

describe('invokeAutomatedTrigger', function () {
let mockClient: codewhispererSdkClient.DefaultCodeWhispererClient

beforeEach(async function () {
await createTestAuthUtil()
sinon.restore()
mockClient = new codewhispererSdkClient.DefaultCodeWhispererClient()
await resetCodeWhispererGlobalVariables()
sinon.stub(mockClient, 'listRecommendations')
sinon.stub(mockClient, 'generateRecommendations')
})

afterEach(function () {
sinon.restore()
})
Expand Down
Loading
Loading