diff options
author | Ismail Cherri <ismail.cherri@sonarsource.com> | 2024-02-22 09:45:11 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-02-22 20:02:53 +0000 |
commit | 5d0acc25ee67fd9e8a41299bb602c95acf94fad1 (patch) | |
tree | 7e68dc22b7ac51fafeb090548c1ee8770b7e2b6b | |
parent | 5508f434eb518a544131a64b4f904a36de9f5b29 (diff) | |
download | sonarqube-5d0acc25ee67fd9e8a41299bb602c95acf94fad1.tar.gz sonarqube-5d0acc25ee67fd9e8a41299bb602c95acf94fad1.zip |
SONAR-21692 Fix jest warnings related to ProjectDumpApp and IssuesApp
3 files changed, 19 insertions, 10 deletions
diff --git a/server/sonar-web/src/main/js/apps/projectDump/ProjectDumpApp.tsx b/server/sonar-web/src/main/js/apps/projectDump/ProjectDumpApp.tsx index a4ad9efe448..c29f06ff088 100644 --- a/server/sonar-web/src/main/js/apps/projectDump/ProjectDumpApp.tsx +++ b/server/sonar-web/src/main/js/apps/projectDump/ProjectDumpApp.tsx @@ -170,7 +170,7 @@ export class ProjectDumpApp extends React.Component<Props, State> { <header className="sw-mb-5"> <Helmet defer={false} title={translate('project_dump.page')} /> <Title className="sw-mb-4">{translate('project_dump.page')}</Title> - <p> + <div> {projectImportFeatureEnabled ? ( <> <p>{translate('project_dump.page.description1')}</p> @@ -182,7 +182,7 @@ export class ProjectDumpApp extends React.Component<Props, State> { <p>{translate('project_dump.page.description_without_import2')}</p> </> )} - </p> + </div> </header> <Spinner loading={status === undefined}> diff --git a/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx b/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx index d1e37fad5d4..ed0305a8f2e 100644 --- a/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { screen } from '@testing-library/react'; +import { act, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import ComputeEngineServiceMock from '../../../api/mocks/ComputeEngineServiceMock'; import { ProjectDumpServiceMock } from '../../../api/mocks/ProjectDumpServiceMock'; @@ -103,6 +103,7 @@ it('should show pending->in progress->failed export', async () => { status: TaskStatuses.Pending, submittedAt: '2023-06-08T11:55:00Z', }); + await userEvent.click(await ui.exportBtn.find()); expect(await ui.pendingExport.find()).toBeInTheDocument(); expect(ui.exportBtn.query()).not.toBeInTheDocument(); @@ -113,7 +114,9 @@ it('should show pending->in progress->failed export', async () => { status: TaskStatuses.InProgress, startedAt: '2023-06-08T12:00:00Z', }); - jest.runOnlyPendingTimers(); + act(() => { + jest.runOnlyPendingTimers(); + }); expect(await ui.inProgressExport.find()).toBeInTheDocument(); expect(ui.exportBtn.query()).not.toBeInTheDocument(); @@ -123,7 +126,9 @@ it('should show pending->in progress->failed export', async () => { status: TaskStatuses.Failed, executedAt: '2023-06-08T12:05:00Z', }); - jest.runOnlyPendingTimers(); + act(() => { + jest.runOnlyPendingTimers(); + }); expect(await ui.failedExport.find()).toBeInTheDocument(); expect(ui.exportBtn.get()).toBeInTheDocument(); }); @@ -159,7 +164,9 @@ it('should show pending->in progress->failed import', async () => { status: TaskStatuses.InProgress, startedAt: '2023-06-08T12:00:00Z', }); - jest.runOnlyPendingTimers(); + act(() => { + jest.runOnlyPendingTimers(); + }); expect(await ui.inProgressImport.find()).toBeInTheDocument(); expect(ui.importBtn.query()).not.toBeInTheDocument(); @@ -169,7 +176,9 @@ it('should show pending->in progress->failed import', async () => { status: TaskStatuses.Failed, executedAt: '2023-06-08T12:05:00Z', }); - jest.runOnlyPendingTimers(); + act(() => { + jest.runOnlyPendingTimers(); + }); expect(await ui.failedImport.find()).toBeInTheDocument(); expect(ui.importBtn.get()).toBeInTheDocument(); }); diff --git a/server/sonar-web/src/main/js/components/rules/MoreInfoRuleDescription.tsx b/server/sonar-web/src/main/js/components/rules/MoreInfoRuleDescription.tsx index 6a1957ed89a..7fa2d76ab28 100644 --- a/server/sonar-web/src/main/js/components/rules/MoreInfoRuleDescription.tsx +++ b/server/sonar-web/src/main/js/components/rules/MoreInfoRuleDescription.tsx @@ -41,7 +41,7 @@ const EDUCATION_PRINCIPLES_MAP: Dict<React.ComponentType<React.PropsWithChildren never_trust_user_input: NeverTrustUserInput, }; -export default class MoreInfoRuleDescription extends React.PureComponent<Props, {}> { +export default class MoreInfoRuleDescription extends React.PureComponent<Props> { handleNotificationScroll = () => { const element = this.props.educationPrinciplesRef?.current; @@ -114,7 +114,7 @@ const StyledEducationPrinciples = styled.div` background-color: ${themeColor('educationPrincipleBackground')}; border: ${themeBorder('default', 'educationPrincipleBorder')}; - & h3:first-child { - margin-top: 0px; + & h3:first-of-type { + margin-top: 0; } `; |