From 069179cdbcb2fbd6e59ea632853f49f4268b6fcd Mon Sep 17 00:00:00 2001 From: Michelle Bergquist Date: Thu, 12 Dec 2024 10:49:37 -0700 Subject: [PATCH] Aws-oidc integration row navigates to details --- .../src/Integrations/IntegrationList.test.tsx | 24 +++++++++++++------ .../src/Integrations/IntegrationList.tsx | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/web/packages/teleport/src/Integrations/IntegrationList.test.tsx b/web/packages/teleport/src/Integrations/IntegrationList.test.tsx index ab96dc061e265..66afc3d8519e5 100644 --- a/web/packages/teleport/src/Integrations/IntegrationList.test.tsx +++ b/web/packages/teleport/src/Integrations/IntegrationList.test.tsx @@ -18,9 +18,11 @@ import React from 'react'; -import { fireEvent, render, screen } from 'design/utils/testing'; +import { fireEvent, render, screen, userEvent } from 'design/utils/testing'; -import { MemoryRouter } from 'react-router'; +import { Router } from 'react-router'; + +import { createMemoryHistory } from 'history'; import { IntegrationList } from 'teleport/Integrations/IntegrationList'; import { @@ -28,29 +30,37 @@ import { IntegrationStatusCode, } from 'teleport/services/integrations'; -test('integration list shows edit and view action menu for aws-oidc', () => { +test('integration list shows edit and view action menu for aws-oidc, row click navigates', async () => { + const history = createMemoryHistory(); + history.push = jest.fn(); + render( - + - + ); fireEvent.click(screen.getByRole('button', { name: 'Options' })); expect(screen.getByText('View Status')).toBeInTheDocument(); expect(screen.getByText('View Status')).toHaveAttribute( 'href', - '/web/integrations/status/aws-oidc/aws' + '/web/integrations/status/aws-oidc/aws-integration' ); expect(screen.getByText('Edit...')).toBeInTheDocument(); expect(screen.getByText('Delete...')).toBeInTheDocument(); + + await userEvent.click(screen.getAllByRole('row')[1]); + expect(history.push).toHaveBeenCalledWith( + '/web/integrations/status/aws-oidc/aws-integration' + ); }); diff --git a/web/packages/teleport/src/Integrations/IntegrationList.tsx b/web/packages/teleport/src/Integrations/IntegrationList.tsx index b4d9c407efaae..a7eadd708a7e1 100644 --- a/web/packages/teleport/src/Integrations/IntegrationList.tsx +++ b/web/packages/teleport/src/Integrations/IntegrationList.tsx @@ -66,7 +66,7 @@ export function IntegrationList(props: Props) { const history = useHistory(); function handleRowClick(row: IntegrationLike) { - if (row.kind !== 'okta') return; + if (row.kind !== 'okta' && row.kind !== IntegrationKind.AwsOidc) return; history.push(cfg.getIntegrationStatusRoute(row.kind, row.name)); }