Skip to content

Commit

Permalink
refactor(Process): ♻️ Make details title optional
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoval committed Jan 8, 2024
1 parent 8678ff7 commit e5ebe57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
8 changes: 1 addition & 7 deletions src/pages/Processes/__tests__/Details.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Suspense } from 'react';

import { render, screen, waitForElementToBeRemoved } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import { Server } from 'miragejs';
import * as router from 'react-router';

import { ProcessResponse } from '@API/REST.interfaces';
import { waitForElementToBeRemovedTimeout } from '@config/config';
import { getTestsIds } from '@config/testIds';
import { Wrapper } from '@core/components/Wrapper';
import processesData from '@mocks/data/PROCESSES.json';
import { loadMockServer } from '@mocks/server';
Expand Down Expand Up @@ -39,10 +37,6 @@ describe('Process component', () => {
});

it('should render the title, description data and processes associated the data loading is complete', async () => {
await waitForElementToBeRemoved(() => screen.queryByTestId(getTestsIds.loadingView()), {
timeout: waitForElementToBeRemovedTimeout
});

expect(screen.getByText(processResult.parentName)).toHaveTextContent('site 1');
expect(screen.getByText(processResult.groupName)).toHaveTextContent('payment');
expect(screen.getByText(processResult.hostName)).toHaveTextContent('10.242.0.5');
Expand Down
10 changes: 6 additions & 4 deletions src/pages/Processes/components/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { SitesRoutesPaths } from '@pages/Sites/Sites.enum';
import { ProcessesLabels, QueriesProcesses } from '../Processes.enum';
import { DetailsProps } from '../Processes.interfaces';

const Details: FC<DetailsProps> = function ({ process, title = ProcessesLabels.Details }) {
const Details: FC<DetailsProps> = function ({ process, title }) {
const {
identity: processId,
parent,
Expand All @@ -50,9 +50,11 @@ const Details: FC<DetailsProps> = function ({ process, title = ProcessesLabels.D

return (
<Card>
<CardTitle>
<Title headingLevel="h2">{title}</Title>
</CardTitle>
{title && (
<CardTitle>
<Title headingLevel="h2">{title}</Title>
</CardTitle>
)}
<CardBody>
<DescriptionList>
<Grid hasGutter>
Expand Down

0 comments on commit e5ebe57

Please sign in to comment.