From 9755a70a604b80f15f27c9d3a81de8ce718f6027 Mon Sep 17 00:00:00 2001 From: joerger Date: Tue, 3 Dec 2024 11:59:41 -0800 Subject: [PATCH] Fix lint; Fix test. --- .../Discover/Server/CreateEc2Ice/CreateEc2IceDialog.tsx | 5 ++--- .../CreatedDiscoveryConfigDialog.tsx | 4 +--- .../src/components/AuthnDialog/AuthnDialog.test.tsx | 3 ++- web/packages/teleport/src/services/mfa/mfaOptions.test.ts | 8 ++++---- web/packages/teleport/src/services/mfa/mfaOptions.ts | 5 ++++- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/web/packages/teleport/src/Discover/Server/CreateEc2Ice/CreateEc2IceDialog.tsx b/web/packages/teleport/src/Discover/Server/CreateEc2Ice/CreateEc2IceDialog.tsx index 98adbba084d88..d325d99b3b123 100644 --- a/web/packages/teleport/src/Discover/Server/CreateEc2Ice/CreateEc2IceDialog.tsx +++ b/web/packages/teleport/src/Discover/Server/CreateEc2Ice/CreateEc2IceDialog.tsx @@ -263,9 +263,8 @@ export function CreateEc2IceDialog({ style={{ display: 'flex', textAlign: 'left', width: '100%' }} > - The EC2 instance [{ - typedAgentMeta?.node.awsMetadata.instanceId - }] has been added to Teleport. + The EC2 instance [{typedAgentMeta?.node.awsMetadata.instanceId}] has + been added to Teleport. nextStep()}> Next diff --git a/web/packages/teleport/src/Discover/Shared/ConfigureDiscoveryService/CreatedDiscoveryConfigDialog.tsx b/web/packages/teleport/src/Discover/Shared/ConfigureDiscoveryService/CreatedDiscoveryConfigDialog.tsx index ecf88ddcecfb2..ee7bf1db8e2d0 100644 --- a/web/packages/teleport/src/Discover/Shared/ConfigureDiscoveryService/CreatedDiscoveryConfigDialog.tsx +++ b/web/packages/teleport/src/Discover/Shared/ConfigureDiscoveryService/CreatedDiscoveryConfigDialog.tsx @@ -90,9 +90,7 @@ export function CreatedDiscoveryConfigDialog({ <> {' '} The discovery service can take a few minutes to finish - auto-enrolling resources found in region - {region} - . + auto-enrolling resources found in region {region}. )} diff --git a/web/packages/teleport/src/components/AuthnDialog/AuthnDialog.test.tsx b/web/packages/teleport/src/components/AuthnDialog/AuthnDialog.test.tsx index 5066113d24400..e4752390357e7 100644 --- a/web/packages/teleport/src/components/AuthnDialog/AuthnDialog.test.tsx +++ b/web/packages/teleport/src/components/AuthnDialog/AuthnDialog.test.tsx @@ -20,7 +20,8 @@ import React from 'react'; import { render, screen, fireEvent } from 'design/utils/testing'; import { makeDefaultMfaState, MfaState } from 'teleport/lib/useMfa'; -import { SSOChallenge } from 'teleport/services/auth'; + +import { SSOChallenge } from 'teleport/services/mfa'; import AuthnDialog from './AuthnDialog'; diff --git a/web/packages/teleport/src/services/mfa/mfaOptions.test.ts b/web/packages/teleport/src/services/mfa/mfaOptions.test.ts index 6b274d2bb3cb8..903cd39becf3e 100644 --- a/web/packages/teleport/src/services/mfa/mfaOptions.test.ts +++ b/web/packages/teleport/src/services/mfa/mfaOptions.test.ts @@ -76,7 +76,7 @@ describe('test retrieving mfa options from MFA Challenge', () => { { name: 'challenge webauthn', challenge: { - webauthnPublicKey: Object.create(PublicKeyCredential), + webauthnPublicKey: {} as PublicKeyCredentialRequestOptions, }, expect: ['webauthn'], }, @@ -85,16 +85,16 @@ describe('test retrieving mfa options from MFA Challenge', () => { challenge: { ssoChallenge: Object.create(SSOChallenge), }, - expect: ['webauthn', 'totp'], + expect: ['sso'], }, { name: 'challenge all', challenge: { totpChallenge: true, - webauthnPublicKey: Object.create(PublicKeyCredential), + webauthnPublicKey: {} as PublicKeyCredentialRequestOptions, ssoChallenge: Object.create(SSOChallenge), }, - expect: ['webauthn', 'totp'], + expect: ['webauthn', 'totp', 'sso'], }, ]; diff --git a/web/packages/teleport/src/services/mfa/mfaOptions.ts b/web/packages/teleport/src/services/mfa/mfaOptions.ts index d24f74337b9b8..c897863566099 100644 --- a/web/packages/teleport/src/services/mfa/mfaOptions.ts +++ b/web/packages/teleport/src/services/mfa/mfaOptions.ts @@ -49,6 +49,9 @@ const totpOption: MfaOption = { value: 'totp', label: 'Authenticator App' }; const getSsoOption = (ssoChallenge: SSOChallenge): MfaOption => { return { value: 'sso', - label: ssoChallenge.device.displayName || ssoChallenge.device.connectorId, + label: + ssoChallenge.device?.displayName || + ssoChallenge.device?.connectorId || + 'SSO', }; };