From db371f8e50c41dbd64d2d3d01e3db6e4ad05ee41 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Thu, 26 Sep 2024 09:25:34 +0200 Subject: [PATCH] fix: test cleanup and remove unused css file --- .../__tests__/ViewAsMenuItems.spec.js | 16 ++++----- .../__tests__/Visualization.spec.js | 20 +---------- .../__snapshots__/Visualization.spec.js.snap | 33 +------------------ .../Visualization/styles/MapPlugin.module.css | 6 ---- 4 files changed, 10 insertions(+), 65 deletions(-) delete mode 100644 src/components/Item/VisualizationItem/Visualization/styles/MapPlugin.module.css diff --git a/src/components/Item/VisualizationItem/ItemContextMenu/__tests__/ViewAsMenuItems.spec.js b/src/components/Item/VisualizationItem/ItemContextMenu/__tests__/ViewAsMenuItems.spec.js index 4a8f31c60..65ba5da27 100644 --- a/src/components/Item/VisualizationItem/ItemContextMenu/__tests__/ViewAsMenuItems.spec.js +++ b/src/components/Item/VisualizationItem/ItemContextMenu/__tests__/ViewAsMenuItems.spec.js @@ -34,8 +34,8 @@ const defaultProps = { test('renders menu for active type MAP and type CHART', async () => { useDhis2ConnectionStatus.mockImplementation(jest.fn(() => online)) const props = Object.assign({}, defaultProps, { - type: CHART, activeType: MAP, + type: CHART, visualization: { type: 'COLUMN', }, @@ -51,8 +51,8 @@ test('renders menu for active type MAP and type CHART', async () => { test('renders menu for active type CHART and type MAP', async () => { useDhis2ConnectionStatus.mockImplementation(jest.fn(() => online)) const props = Object.assign({}, defaultProps, { - type: MAP, activeType: CHART, + type: MAP, visualization: { mapViews: [{ layer: 'thematic' }], }, @@ -87,8 +87,8 @@ test('renders disabled menu items when offline', () => { test('renders menu for active type MAP and type MAP without Thematic layer', async () => { useDhis2ConnectionStatus.mockImplementation(jest.fn(() => online)) const props = Object.assign({}, defaultProps, { - type: MAP, activeType: MAP, + type: MAP, visualization: { mapViews: [{ layer: 'earthEngine' }], }, @@ -110,8 +110,8 @@ test('renders menu for active type MAP and type MAP without Thematic layer', asy test('renders menu for active type MAP and type MAP without Thematic layer when offline', async () => { useDhis2ConnectionStatus.mockImplementation(jest.fn(() => offline)) const props = Object.assign({}, defaultProps, { - type: MAP, activeType: MAP, + type: MAP, visualization: { mapViews: [{ layer: 'earthEngine' }], }, @@ -133,8 +133,8 @@ test('renders menu for active type MAP and type MAP without Thematic layer when test('renders menu for active type REPORT_TABLE and type CHART', async () => { useDhis2ConnectionStatus.mockImplementation(jest.fn(() => online)) const props = Object.assign({}, defaultProps, { - type: CHART, activeType: REPORT_TABLE, + type: CHART, visualization: { type: 'COLUMN' }, }) @@ -148,8 +148,8 @@ test('renders menu for active type REPORT_TABLE and type CHART', async () => { test('renders menu for active type CHART and type REPORT_TABLE', async () => { useDhis2ConnectionStatus.mockImplementation(jest.fn(() => online)) const props = Object.assign({}, defaultProps, { - type: REPORT_TABLE, activeType: CHART, + type: REPORT_TABLE, visualization: { type: 'PIVOT_TABLE' }, }) @@ -163,8 +163,8 @@ test('renders menu for active type CHART and type REPORT_TABLE', async () => { test('renders menu for active type EVENT_REPORT and type EVENT_CHART', async () => { useDhis2ConnectionStatus.mockImplementation(jest.fn(() => online)) const props = Object.assign({}, defaultProps, { - type: EVENT_CHART, activeType: EVENT_REPORT, + type: EVENT_CHART, visualization: {}, }) @@ -178,8 +178,8 @@ test('renders menu for active type EVENT_REPORT and type EVENT_CHART', async () test('renders menu for active type EVENT_CHART and type EVENT_REPORT', async () => { useDhis2ConnectionStatus.mockImplementation(jest.fn(() => online)) const props = Object.assign({}, defaultProps, { - type: EVENT_REPORT, activeType: EVENT_CHART, + type: EVENT_REPORT, visualization: {}, }) diff --git a/src/components/Item/VisualizationItem/Visualization/__tests__/Visualization.spec.js b/src/components/Item/VisualizationItem/Visualization/__tests__/Visualization.spec.js index d9281decd..9bf07295a 100644 --- a/src/components/Item/VisualizationItem/Visualization/__tests__/Visualization.spec.js +++ b/src/components/Item/VisualizationItem/Visualization/__tests__/Visualization.spec.js @@ -38,7 +38,7 @@ const DEFAULT_STORE_WITH_ONE_ITEM = { }, } -test('renders a MapPlugin when activeType is MAP', () => { +test('renders a VisualizationPlugin when activeType is MAP', () => { const { container } = render( { expect(container).toMatchSnapshot() }) -test('renders active type MAP rather than original type REPORT_TABLE', () => { - const { container } = render( - - - - ) - expect(container).toMatchSnapshot() -}) - test('renders a DefaultPlugin when activeType is EVENT_CHART', () => { const { container } = render( diff --git a/src/components/Item/VisualizationItem/Visualization/__tests__/__snapshots__/Visualization.spec.js.snap b/src/components/Item/VisualizationItem/Visualization/__tests__/__snapshots__/Visualization.spec.js.snap index 1b43b40aa..d8e7bbf3d 100644 --- a/src/components/Item/VisualizationItem/Visualization/__tests__/__snapshots__/Visualization.spec.js.snap +++ b/src/components/Item/VisualizationItem/Visualization/__tests__/__snapshots__/Visualization.spec.js.snap @@ -93,37 +93,6 @@ exports[`renders a DefaultPlugin when activeType is EVENT_REPORT 1`] = ` `; -exports[`renders a MapPlugin when activeType is MAP 1`] = ` -
-
-
-
- - - - No data to display -
-
-
-
-`; - exports[`renders a VisualizationPlugin for CHART 1`] = `
`; -exports[`renders active type MAP rather than original type REPORT_TABLE 1`] = ` +exports[`renders a VisualizationPlugin when activeType is MAP 1`] = `