From 7dac74fc63a9b74de3ceae600ee4817f6bf8d295 Mon Sep 17 00:00:00 2001 From: Viktor Vorona Date: Mon, 12 Jun 2023 12:18:33 +0200 Subject: [PATCH] SONAR-18434 RTL Migration Project Dump --- .../js/api/mocks/ProjectDumpServiceMock.ts | 98 +++++++ .../__tests__/ProjectDumpApp-it.tsx | 198 ++++++++++++++ .../__tests__/ProjectDumpApp-test.tsx | 99 ------- .../ProjectDumpApp-test.tsx.snap | 158 ----------- .../components/__tests__/Export-test.tsx | 62 ----- .../components/__tests__/Import-test.tsx | 71 ----- .../__snapshots__/Export-test.tsx.snap | 206 -------------- .../__snapshots__/Import-test.tsx.snap | 252 ------------------ .../src/main/js/types/project-dump.ts | 4 +- 9 files changed, 298 insertions(+), 850 deletions(-) create mode 100644 server/sonar-web/src/main/js/api/mocks/ProjectDumpServiceMock.ts create mode 100644 server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx delete mode 100644 server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-test.tsx delete mode 100644 server/sonar-web/src/main/js/apps/projectDump/__tests__/__snapshots__/ProjectDumpApp-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Export-test.tsx delete mode 100644 server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Import-test.tsx delete mode 100644 server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Export-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Import-test.tsx.snap diff --git a/server/sonar-web/src/main/js/api/mocks/ProjectDumpServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/ProjectDumpServiceMock.ts new file mode 100644 index 00000000000..88124a9fe8f --- /dev/null +++ b/server/sonar-web/src/main/js/api/mocks/ProjectDumpServiceMock.ts @@ -0,0 +1,98 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import { cloneDeep } from 'lodash'; +import { TaskStatuses, TaskTypes } from '../../types/tasks'; +import { doExport, doImport, getStatus } from '../project-dump'; +import ComputeEngineServiceMock from './ComputeEngineServiceMock'; + +jest.mock('../project-dump'); + +export class ProjectDumpServiceMock { + #ceService: ComputeEngineServiceMock; + canBeExported = true; + canBeImported = false; + #customTasks = false; + exportedDump: string | undefined = undefined; + dumpToImport: string | undefined = undefined; + + constructor(ceService: ComputeEngineServiceMock) { + this.#ceService = ceService; + + jest.mocked(doExport).mockImplementation(this.doExportHandler); + jest.mocked(doImport).mockImplementation(this.doImportHandler); + jest.mocked(getStatus).mockImplementation(this.getStatusHandler); + } + + reset = () => { + this.canBeImported = false; + this.canBeExported = true; + this.#customTasks = false; + this.exportedDump = undefined; + this.dumpToImport = undefined; + }; + + setImportState = () => { + this.canBeImported = true; + this.canBeExported = false; + this.dumpToImport = 'tmp/test.zip'; + }; + + useCustomTasks = () => { + this.#customTasks = true; + }; + + doExportHandler = (componentKey: string) => { + if (!this.#customTasks) { + this.#ceService.addTask({ + componentKey, + type: TaskTypes.ProjectExport, + status: TaskStatuses.Success, + executedAt: '2023-06-08T12:00:00Z', + }); + } + this.exportedDump = `/tmp/${componentKey}.zip`; + return this.reply({}); + }; + + doImportHandler = (componentKey: string) => { + if (!this.#customTasks) { + this.#ceService.addTask({ + componentKey, + type: TaskTypes.ProjectImport, + status: TaskStatuses.Success, + executedAt: '2023-06-08T12:00:00Z', + }); + } + return this.reply({}); + }; + + getStatusHandler = () => { + return this.reply({ + canBeExported: this.canBeExported, + canBeImported: this.canBeImported, + exportedDump: this.exportedDump, + dumpToImport: this.dumpToImport, + }); + }; + + reply(response: T): Promise { + return Promise.resolve(cloneDeep(response)); + } +} 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 new file mode 100644 index 00000000000..6343f5a293a --- /dev/null +++ b/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx @@ -0,0 +1,198 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * 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 userEvent from '@testing-library/user-event'; +import { byRole, byText } from 'testing-library-selector'; +import ComputeEngineServiceMock from '../../../api/mocks/ComputeEngineServiceMock'; +import { ProjectDumpServiceMock } from '../../../api/mocks/ProjectDumpServiceMock'; +import { mockComponent } from '../../../helpers/mocks/component'; +import { renderAppWithComponentContext } from '../../../helpers/testReactTestingUtils'; +import { Feature } from '../../../types/features'; +import { TaskStatuses, TaskTypes } from '../../../types/tasks'; +import routes from '../routes'; + +const computeEngineHandler = new ComputeEngineServiceMock(); +const handler = new ProjectDumpServiceMock(computeEngineHandler); + +const COMPONENT_KEY = 'test'; + +const ui = { + pageDescriptionWithImport: byText('project_dump.page.description'), + pageDescriptionWithoutImport: byText('project_dump.page.description_without_import'), + + disabledImportFeatureMsg: byText('project_dump.import_form_description_disabled'), + + exportBtn: byRole('button', { name: 'project_dump.do_export' }), + importBtn: byRole('button', { name: 'project_dump.do_import' }), + + successExport: byText('project_dump.latest_export_available.June 8, 2023 at', { exact: false }), + pendingExport: byText('project_dump.pending_export.June 8, 2023 at', { exact: false }), + inProgressExport: byText('project_dump.in_progress_export.1 hour ago'), + failedExport: byText('project_dump.failed_export'), + cantExportMsg: byText('project_dump.can_not_export'), + + successImport: byText('project_dump.import_success.June 8, 2023 at', { exact: false }), + pendingImport: byText('project_dump.pending_import.June 8, 2023 at', { exact: false }), + inProgressImport: byText('project_dump.in_progress_import.1 hour ago'), + failedImport: byText('project_dump.failed_import'), + cantImportMsg: byText('project_dump.can_not_import'), + noDumpImportMsg: byText('project_dump.no_file_to_import'), +}; + +afterAll(() => { + jest.useRealTimers(); +}); + +beforeEach(() => { + computeEngineHandler.reset(); + handler.reset(); + jest.useFakeTimers({ + advanceTimers: true, + now: new Date('2023-06-08T13:00:00Z'), + }); +}); + +it('can export project, but can not import', async () => { + renderProjectKeyApp([Feature.ProjectImport]); + expect(await ui.exportBtn.find()).toBeInTheDocument(); + expect(ui.importBtn.query()).not.toBeInTheDocument(); + expect(ui.pageDescriptionWithImport.get()).toBeInTheDocument(); + expect(ui.pageDescriptionWithoutImport.query()).not.toBeInTheDocument(); + expect(ui.cantImportMsg.get()).toBeInTheDocument(); + await userEvent.click(ui.exportBtn.get()); + expect(await ui.successExport.find()).toBeInTheDocument(); + expect(screen.getByText(`/tmp/${COMPONENT_KEY}.zip`)).toBeInTheDocument(); +}); + +it('can export project without import feature', async () => { + renderProjectKeyApp([]); + expect(await ui.exportBtn.find()).toBeInTheDocument(); + expect(ui.importBtn.query()).not.toBeInTheDocument(); + expect(ui.pageDescriptionWithoutImport.get()).toBeInTheDocument(); + expect(ui.pageDescriptionWithImport.query()).not.toBeInTheDocument(); + expect(ui.disabledImportFeatureMsg.get()).toBeInTheDocument(); + await userEvent.click(ui.exportBtn.get()); + expect(await ui.successExport.find()).toBeInTheDocument(); + expect(screen.getByText(`/tmp/${COMPONENT_KEY}.zip`)).toBeInTheDocument(); +}); + +it('should show pending->in progress->failed export', async () => { + handler.useCustomTasks(); + renderProjectKeyApp([]); + computeEngineHandler.addTask({ + componentKey: COMPONENT_KEY, + type: TaskTypes.ProjectExport, + 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(); + + computeEngineHandler.addTask({ + componentKey: COMPONENT_KEY, + type: TaskTypes.ProjectExport, + status: TaskStatuses.InProgress, + startedAt: '2023-06-08T12:00:00Z', + }); + jest.runOnlyPendingTimers(); + expect(await ui.inProgressExport.find()).toBeInTheDocument(); + expect(ui.exportBtn.query()).not.toBeInTheDocument(); + + computeEngineHandler.addTask({ + componentKey: COMPONENT_KEY, + type: TaskTypes.ProjectExport, + status: TaskStatuses.Failed, + }); + jest.runOnlyPendingTimers(); + expect(await ui.failedExport.find()).toBeInTheDocument(); + expect(ui.exportBtn.get()).toBeInTheDocument(); +}); + +it('can import project once, and can not export', async () => { + handler.setImportState(); + renderProjectKeyApp([Feature.ProjectImport]); + expect(await ui.importBtn.find()).toBeInTheDocument(); + expect(ui.exportBtn.query()).not.toBeInTheDocument(); + expect(ui.cantExportMsg.get()).toBeInTheDocument(); + await userEvent.click(ui.importBtn.get()); + expect(await ui.successImport.find()).toBeInTheDocument(); + expect(ui.importBtn.query()).not.toBeInTheDocument(); +}); + +it('should show pending->in progress->failed import', async () => { + handler.useCustomTasks(); + handler.setImportState(); + renderProjectKeyApp([Feature.ProjectImport]); + computeEngineHandler.addTask({ + componentKey: COMPONENT_KEY, + type: TaskTypes.ProjectImport, + status: TaskStatuses.Pending, + submittedAt: '2023-06-08T11:55:00Z', + }); + await userEvent.click(await ui.importBtn.find()); + expect(await ui.pendingImport.find()).toBeInTheDocument(); + expect(ui.importBtn.query()).not.toBeInTheDocument(); + + computeEngineHandler.addTask({ + componentKey: COMPONENT_KEY, + type: TaskTypes.ProjectImport, + status: TaskStatuses.InProgress, + startedAt: '2023-06-08T12:00:00Z', + }); + jest.runOnlyPendingTimers(); + expect(await ui.inProgressImport.find()).toBeInTheDocument(); + expect(ui.importBtn.query()).not.toBeInTheDocument(); + + computeEngineHandler.addTask({ + componentKey: COMPONENT_KEY, + type: TaskTypes.ProjectImport, + status: TaskStatuses.Failed, + }); + jest.runOnlyPendingTimers(); + expect(await ui.failedImport.find()).toBeInTheDocument(); + expect(ui.importBtn.get()).toBeInTheDocument(); +}); + +it(`can't import if no dump file`, async () => { + handler.setImportState(); + handler.dumpToImport = undefined; + renderProjectKeyApp([Feature.ProjectImport]); + expect(await ui.noDumpImportMsg.find()).toBeInTheDocument(); + expect(ui.importBtn.query()).not.toBeInTheDocument(); +}); + +it('can do nothing', async () => { + handler.setImportState(); + renderProjectKeyApp([]); + expect(await ui.cantExportMsg.find()).toBeInTheDocument(); + expect(ui.importBtn.query()).not.toBeInTheDocument(); + expect(ui.exportBtn.query()).not.toBeInTheDocument(); + expect(ui.disabledImportFeatureMsg.get()).toBeInTheDocument(); +}); + +function renderProjectKeyApp(featureList: Feature[] = []) { + return renderAppWithComponentContext( + 'import_export', + routes, + { featureList }, + { component: mockComponent({ key: COMPONENT_KEY }) } + ); +} diff --git a/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-test.tsx b/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-test.tsx deleted file mode 100644 index ca4c049f451..00000000000 --- a/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-test.tsx +++ /dev/null @@ -1,99 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { getActivity } from '../../../api/ce'; -import { getStatus } from '../../../api/project-dump'; -import { mockComponent } from '../../../helpers/mocks/component'; -import { mockDumpStatus, mockDumpTask } from '../../../helpers/testMocks'; -import { waitAndUpdate } from '../../../helpers/testUtils'; -import { TaskStatuses } from '../../../types/tasks'; -import { ProjectDumpApp } from '../ProjectDumpApp'; - -jest.mock('../../../api/ce', () => ({ - getActivity: jest.fn().mockResolvedValue({ tasks: [] }), -})); - -jest.mock('../../../api/project-dump', () => ({ - getStatus: jest.fn().mockResolvedValue({}), -})); - -beforeEach(() => { - jest.useFakeTimers(); - jest.clearAllMocks(); -}); - -afterEach(() => { - jest.runOnlyPendingTimers(); - jest.useRealTimers(); -}); - -it('should render correctly', async () => { - (getActivity as jest.Mock) - .mockResolvedValueOnce({ tasks: [mockDumpTask()] }) - .mockResolvedValueOnce({ tasks: [mockDumpTask()] }) - .mockResolvedValueOnce({ tasks: [mockDumpTask()] }); - - let wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot('loading'); - - await waitAndUpdate(wrapper); - - expect(wrapper).toMatchSnapshot('loaded'); - - wrapper = shallowRender({ hasFeature: jest.fn().mockReturnValue(false) }); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot('loaded without import'); -}); - -it('should poll for task status update', async () => { - const wrapper = shallowRender(); - await waitAndUpdate(wrapper); - - jest.clearAllMocks(); - - const finalStatus = mockDumpStatus({ exportedDump: 'export-path' }); - (getStatus as jest.Mock) - .mockResolvedValueOnce(mockDumpStatus()) - .mockResolvedValueOnce(finalStatus); - (getActivity as jest.Mock) - .mockResolvedValueOnce({ tasks: [mockDumpTask({ status: TaskStatuses.Pending })] }) - .mockResolvedValueOnce({ tasks: [mockDumpTask({ status: TaskStatuses.Success })] }); - - wrapper.instance().poll(); - - // wait for all promises - await waitAndUpdate(wrapper); - jest.runAllTimers(); - await waitAndUpdate(wrapper); - - expect(getStatus).toHaveBeenCalledTimes(2); - expect(wrapper.state().status).toBe(finalStatus); -}); - -function shallowRender(overrides: Partial = {}) { - return shallow( - - ); -} diff --git a/server/sonar-web/src/main/js/apps/projectDump/__tests__/__snapshots__/ProjectDumpApp-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectDump/__tests__/__snapshots__/ProjectDumpApp-test.tsx.snap deleted file mode 100644 index caba04a83e9..00000000000 --- a/server/sonar-web/src/main/js/apps/projectDump/__tests__/__snapshots__/ProjectDumpApp-test.tsx.snap +++ /dev/null @@ -1,158 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: loaded 1`] = ` -
- -
-

- project_dump.page -

-
- project_dump.page.description -
-
-
-
- -
-
- -
-
-
-`; - -exports[`should render correctly: loaded without import 1`] = ` -
- -
-

- project_dump.page -

-
- project_dump.page.description_without_import -
-
-
-
- -
-
- -
-
-
-`; - -exports[`should render correctly: loading 1`] = ` -
- -
-

- project_dump.page -

-
- project_dump.page.description -
-
- -
-`; diff --git a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Export-test.tsx b/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Export-test.tsx deleted file mode 100644 index e4be5cd0285..00000000000 --- a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Export-test.tsx +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockDumpStatus, mockDumpTask } from '../../../../helpers/testMocks'; -import { TaskStatuses } from '../../../../types/tasks'; -import Export from '../Export'; - -jest.mock('../../../../api/project-dump', () => ({ - doExport: jest.fn().mockResolvedValue({}), -})); - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('no task'); - expect(shallowRender({ status: mockDumpStatus({ canBeExported: false }) })).toMatchSnapshot( - 'cannot export' - ); - expect(shallowRender({ task: mockDumpTask({ status: TaskStatuses.Pending }) })).toMatchSnapshot( - 'task pending' - ); - expect( - shallowRender({ task: mockDumpTask({ status: TaskStatuses.InProgress }) }) - ).toMatchSnapshot('task in progress'); - expect(shallowRender({ task: mockDumpTask({ status: TaskStatuses.Failed }) })).toMatchSnapshot( - 'task failed' - ); - expect( - shallowRender({ - status: mockDumpStatus({ exportedDump: 'dump-file' }), - task: mockDumpTask({ status: TaskStatuses.Success }), - }) - ).toMatchSnapshot('success'); -}); - -function shallowRender(overrides: Partial = {}) { - return shallow( - - ); -} diff --git a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Import-test.tsx b/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Import-test.tsx deleted file mode 100644 index 95f1fdcc6e4..00000000000 --- a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Import-test.tsx +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockDumpStatus, mockDumpTask } from '../../../../helpers/testMocks'; -import { TaskStatuses } from '../../../../types/tasks'; -import Import from '../Import'; - -jest.mock('../../../../api/project-dump', () => ({ - doImport: jest.fn().mockResolvedValue({}), -})); - -it('should render correctly', () => { - expect( - shallowRender({ status: mockDumpStatus({ dumpToImport: 'import-file.zip' }) }) - ).toMatchSnapshot('import form'); - expect(shallowRender()).toMatchSnapshot('no dump to import'); - expect(shallowRender({ status: mockDumpStatus({ canBeImported: false }) })).toMatchSnapshot( - 'cannot import' - ); - expect(shallowRender({ task: mockDumpTask({ status: TaskStatuses.Success }) })).toMatchSnapshot( - 'success' - ); - expect( - shallowRender({ - analysis: mockDumpTask(), - task: mockDumpTask({ status: TaskStatuses.Success }), - }) - ).toMatchSnapshot('success, but with analysis -> show form'); - expect(shallowRender({ task: mockDumpTask({ status: TaskStatuses.Pending }) })).toMatchSnapshot( - 'pending' - ); - expect( - shallowRender({ task: mockDumpTask({ status: TaskStatuses.InProgress }) }) - ).toMatchSnapshot('in progress'); - expect(shallowRender({ task: mockDumpTask({ status: TaskStatuses.Failed }) })).toMatchSnapshot( - 'failed' - ); - expect(shallowRender({ importEnabled: false })).toMatchSnapshot('import disabled'); -}); - -function shallowRender(overrides: Partial = {}) { - return shallow( - - ); -} diff --git a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Export-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Export-test.tsx.snap deleted file mode 100644 index 8e02d72a15c..00000000000 --- a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Export-test.tsx.snap +++ /dev/null @@ -1,206 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: cannot export 1`] = ` -
-
-

- project_dump.export -

-
-
- - project_dump.can_not_export - -
-
-`; - -exports[`should render correctly: no task 1`] = ` -
-
-

- project_dump.export -

-
-
-
-
- project_dump.export_form_description -
- -
-
-
-`; - -exports[`should render correctly: success 1`] = ` -
-
-

- project_dump.export -

-
-
- - - - -
- - dump-file - -
-
-
-
- project_dump.export_form_description -
- -
-
-
-`; - -exports[`should render correctly: task failed 1`] = ` -
-
-

- project_dump.export -

-
-
- - project_dump.failed_export - - project_dump.see_details - - -
-
- project_dump.export_form_description -
- -
-
-
-`; - -exports[`should render correctly: task in progress 1`] = ` -
-
-

- project_dump.export -

-
-
- - - - -
-
-`; - -exports[`should render correctly: task pending 1`] = ` -
-
-

- project_dump.export -

-
-
- - - - -
-
-`; diff --git a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Import-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Import-test.tsx.snap deleted file mode 100644 index 0a0c403a888..00000000000 --- a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Import-test.tsx.snap +++ /dev/null @@ -1,252 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: cannot import 1`] = ` -
-
-

- project_dump.import -

-
-
- project_dump.can_not_import -
-
-`; - -exports[`should render correctly: failed 1`] = ` -
-
-

- project_dump.import -

-
-
- - project_dump.failed_import - - project_dump.see_details - - -
-
- project_dump.import_form_description -
- -
-
-
-`; - -exports[`should render correctly: import disabled 1`] = ` -
-
-

- project_dump.import -

-
-
- project_dump.import_form_description_disabled -
-
-`; - -exports[`should render correctly: import form 1`] = ` -
-
-

- project_dump.import -

-
-
-
-
- project_dump.import_form_description -
- -
-
-
-`; - -exports[`should render correctly: in progress 1`] = ` -
-
-

- project_dump.import -

-
-
- - - - -
-
-`; - -exports[`should render correctly: no dump to import 1`] = ` -
-
-

- project_dump.import -

-
-
- - project_dump.no_file_to_import - -
-
-`; - -exports[`should render correctly: pending 1`] = ` -
-
-

- project_dump.import -

-
-
- - - - -
-
-`; - -exports[`should render correctly: success 1`] = ` -
-
-

- project_dump.import -

-
-
- - - -
-
-`; - -exports[`should render correctly: success, but with analysis -> show form 1`] = ` -
-
-

- project_dump.import -

-
-
- - project_dump.no_file_to_import - -
-
-`; diff --git a/server/sonar-web/src/main/js/types/project-dump.ts b/server/sonar-web/src/main/js/types/project-dump.ts index f42c5dc0434..7295e958d16 100644 --- a/server/sonar-web/src/main/js/types/project-dump.ts +++ b/server/sonar-web/src/main/js/types/project-dump.ts @@ -22,8 +22,8 @@ import { TaskStatuses } from './tasks'; export interface DumpStatus { canBeExported: boolean; canBeImported: boolean; - dumpToImport: string; - exportedDump: string; + dumpToImport?: string; + exportedDump?: string; } export interface DumpTask { -- 2.39.5