Skip to content

Commit 7b30f9d

Browse files
committed
fix duplicate code and runtimes type error
1 parent e3dab40 commit 7b30f9d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/amazonq/test/unit/codewhisperer/util/authUtil.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,11 @@ describe('AuthUtil', async function () {
293293
if (!(auth as any).session){
294294
auth.session = new auth2.SsoLogin(auth.profileName, auth.lspAuth, auth.eventEmitter)
295295
}
296-
const updateProfileStub = sinon.stub((auth as any).session, 'updateProfile').resolves()
296+
const updateProfileStub_3 = sinon.stub((auth as any).session, 'updateProfile').resolves()
297297

298298
await auth.migrateSsoConnectionToLsp('test-client')
299299

300-
assert.ok(updateProfileStub.calledOnce)
300+
assert.ok(updateProfileStub_3.calledOnce)
301301
assert.ok(memento.update.calledWith('auth.profiles', undefined))
302302
})
303303

@@ -364,13 +364,13 @@ describe('AuthUtil', async function () {
364364
auth.session = new auth2.SsoLogin(auth.profileName, auth.lspAuth, auth.eventEmitter)
365365
}
366366

367-
const updateProfileStub = sinon.stub((auth as any).session, 'updateProfile').resolves()
367+
const updateProfileStub_2 = sinon.stub((auth as any).session, 'updateProfile').resolves()
368368

369369
await auth.migrateSsoConnectionToLsp('test-client')
370370

371-
assert.ok(updateProfileStub.calledOnce)
371+
assert.ok(updateProfileStub_2.calledOnce)
372372
assert.ok(memento.update.calledWith('auth.profiles', undefined))
373-
assert.deepStrictEqual(updateProfileStub.firstCall.args[0], {
373+
assert.deepStrictEqual(updateProfileStub_2.firstCall.args[0], {
374374
startUrl: validProfile.startUrl,
375375
region: validProfile.ssoRegion,
376376
scopes: validProfile.scopes,

packages/core/src/auth/auth2.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export class LanguageClientAuth {
132132
{
133133
profileName: profileName,
134134
options: {
135-
generateOnInvalidStsCredential: login,
135+
callStsOnInvalidIamCredential: login,
136136
},
137137
} satisfies GetIamCredentialParams,
138138
cancellationToken
@@ -173,7 +173,7 @@ export class LanguageClientAuth {
173173
let profile: Profile
174174
if (roleArn) {
175175
profile = {
176-
kinds: [ProfileKind.IamRoleSourceProfile],
176+
kinds: [ProfileKind.IamSourceProfileProfile],
177177
name: profileName,
178178
settings: {
179179
sso_session: '',
@@ -186,7 +186,7 @@ export class LanguageClientAuth {
186186
}
187187
} else if (accessKey && secretKey) {
188188
profile = {
189-
kinds: [ProfileKind.IamUserProfile],
189+
kinds: [ProfileKind.IamCredentialsProfile],
190190
name: profileName,
191191
settings: {
192192
sso_session: '',

0 commit comments

Comments
 (0)