Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add integration count number #414

Merged
merged 2 commits into from
Sep 9, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ const CustomerIntegrations = ({
const { ADMIN_PORTAL_BASE_URL } = getConfig();
const ssoDateText = ({ sso }) => (`Created ${formatDate(sso?.created)} • Last modified ${formatDate(sso?.modifed)}`);
const configDateText = ({ config }) => (`Created ${formatDate(config?.created)} • Last modified ${formatDate(config?.lastModifiedAt)}`);
let integrationCount = (activeSSO ? activeSSO.length : 0) + (activeIntegrations ? activeIntegrations.length : 0);
if (apiCredentialsEnabled) {
integrationCount++;
}

return (
<div>
{(activeSSO || activeIntegrations || apiCredentialsEnabled) && (
{(integrationCount > 0) && (
<div>
<h2>Associated integrations</h2>
<h2>Associated integrations ({integrationCount})</h2>
<hr />
{activeSSO && activeSSO.map((sso) => (
<CustomerViewCard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ describe('CustomerViewIntegrations', () => {
</IntlProvider>,
);
await waitFor(() => {
expect(screen.getByText('Associated integrations')).toBeInTheDocument();

expect(screen.getByText('Associated integrations (4)')).toBeInTheDocument();
expect(screen.getByText('SSO')).toBeInTheDocument();
expect(screen.getByText('Orange cats rule')).toBeInTheDocument();
expect(screen.getAllByText('Created September 15, 2024 • Last modified September 15, 2024')).toHaveLength(3);
Expand Down