Skip to content

Commit

Permalink
Aws-oidc integration row navigates to details
Browse files Browse the repository at this point in the history
  • Loading branch information
michellescripts committed Dec 12, 2024
1 parent 33f55b9 commit 4513534
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
24 changes: 17 additions & 7 deletions web/packages/teleport/src/Integrations/IntegrationList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,49 @@

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 {
IntegrationKind,
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(
<MemoryRouter>
<Router history={history}>
<IntegrationList
list={[
{
resourceType: 'integration',
name: 'aws',
name: 'aws-integration',
kind: IntegrationKind.AwsOidc,
statusCode: IntegrationStatusCode.Running,
spec: { roleArn: '', issuerS3Prefix: '', issuerS3Bucket: '' },
},
]}
/>
</MemoryRouter>
</Router>
);

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'
);
});
2 changes: 1 addition & 1 deletion web/packages/teleport/src/Integrations/IntegrationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function IntegrationList(props: Props<IntegrationLike>) {
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));
}

Expand Down

0 comments on commit 4513534

Please sign in to comment.