From 7031fa6588c0bccbdf49a6a44335a5db7c7b23d1 Mon Sep 17 00:00:00 2001 From: Ian Wright Date: Thu, 6 Jul 2023 20:04:37 +0100 Subject: [PATCH] Fixed tests --- .../ClipPath/RectangleClipPath.unit.tsx | 29 +++++++++++++++---- .../RectangleClipPath.unit.tsx.snap | 8 ++--- .../Area/__snapshots__/Area.unit.tsx.snap | 3 ++ .../__snapshots__/StackedArea.unit.tsx.snap | 3 ++ .../Area/__snapshots__/Areas.unit.tsx.snap | 3 ++ .../Bar/Bar/__snapshots__/Bar.unit.tsx.snap | 3 ++ .../__snapshots__/GroupedBar.unit.tsx.snap | 3 ++ .../__snapshots__/StackedBar.unit.tsx.snap | 3 ++ .../Bar/__snapshots__/Bars.unit.tsx.snap | 2 ++ .../Column/__snapshots__/Column.unit.tsx.snap | 3 ++ .../__snapshots__/GroupedColumn.unit.tsx.snap | 3 ++ .../__snapshots__/StackedColumn.unit.tsx.snap | 3 ++ .../__snapshots__/Columns.unit.tsx.snap | 2 ++ .../Line/__snapshots__/Line.unit.tsx.snap | 3 ++ .../Line/__snapshots__/Lines.unit.tsx.snap | 2 ++ .../__snapshots__/Scatter.unit.tsx.snap | 3 ++ .../__snapshots__/Scatters.unit.tsx.snap | 2 ++ .../src/lib/components/XYChart/XYChart.tsx | 2 +- .../lib/components/ZoomBrush/ZoomBrush.tsx | 2 +- .../react/src/lib/store/chart/chartActions.ts | 2 +- .../src/lib/store/chart/chartSelectors.ts | 2 +- .../store/chart/tests/chartReducer.unit.ts | 2 +- .../src/lib/testUtils/createMockStore.ts | 2 +- 23 files changed, 75 insertions(+), 15 deletions(-) diff --git a/packages/react/src/lib/components/ClipPath/RectangleClipPath.unit.tsx b/packages/react/src/lib/components/ClipPath/RectangleClipPath.unit.tsx index 1618cb87..1d887058 100644 --- a/packages/react/src/lib/components/ClipPath/RectangleClipPath.unit.tsx +++ b/packages/react/src/lib/components/ClipPath/RectangleClipPath.unit.tsx @@ -1,20 +1,39 @@ +import { Provider, useSelector } from "react-redux"; import React from "react"; -import { renderChart, wait } from "../../testUtils"; +import { chartSelectors, IState } from "../../store"; +import { createMockStore, renderChart, wait } from "../../testUtils"; +import { themes } from "../../themes"; import { RectangleClipPath } from "./RectangleClipPath"; describe("RectangleClipPath", () => { - const Circle = ({ clipPath }: { clipPath?: string }) => { - return ; + const store = createMockStore({ + chart: { + dimensions: { + width: 800, + height: 400, + }, + theme: themes.light, + }, + event: { + mouse: { x: 150, y: 200 }, + }, + }); + + const Circle = () => { + const plotClipPath = useSelector((s: IState) => chartSelectors.plotClipPath(s)); + + return ; }; it("renders correctly", async () => { const { asFragment } = await renderChart({ children: ( - + + - + ), }); diff --git a/packages/react/src/lib/components/ClipPath/__snapshots__/RectangleClipPath.unit.tsx.snap b/packages/react/src/lib/components/ClipPath/__snapshots__/RectangleClipPath.unit.tsx.snap index 44c81227..db54e8d3 100644 --- a/packages/react/src/lib/components/ClipPath/__snapshots__/RectangleClipPath.unit.tsx.snap +++ b/packages/react/src/lib/components/ClipPath/__snapshots__/RectangleClipPath.unit.tsx.snap @@ -5,18 +5,18 @@ exports[`RectangleClipPath renders correctly 1`] = ` @@ -35,6 +37,7 @@ exports[`Area using SVG should skip rendering if there is no y scale avaliable 1 diff --git a/packages/react/src/lib/components/Plots/Area/StackedArea/__snapshots__/StackedArea.unit.tsx.snap b/packages/react/src/lib/components/Plots/Area/StackedArea/__snapshots__/StackedArea.unit.tsx.snap index 50de6fc1..218923f9 100644 --- a/packages/react/src/lib/components/Plots/Area/StackedArea/__snapshots__/StackedArea.unit.tsx.snap +++ b/packages/react/src/lib/components/Plots/Area/StackedArea/__snapshots__/StackedArea.unit.tsx.snap @@ -5,6 +5,7 @@ exports[`StackedArea using SVG should render correctly 1`] = ` @@ -36,6 +38,7 @@ exports[`StackedArea using SVG should skip rendering if there is no y scale aval diff --git a/packages/react/src/lib/components/Plots/Area/__snapshots__/Areas.unit.tsx.snap b/packages/react/src/lib/components/Plots/Area/__snapshots__/Areas.unit.tsx.snap index 3db45344..26fffc69 100644 --- a/packages/react/src/lib/components/Plots/Area/__snapshots__/Areas.unit.tsx.snap +++ b/packages/react/src/lib/components/Plots/Area/__snapshots__/Areas.unit.tsx.snap @@ -5,6 +5,7 @@ exports[`Areas Multiple Series using SVG should render correctly 1`] = ` @@ -42,6 +44,7 @@ exports[`Bar using SVG should skip rendering if there is no y scale avaliable 1` diff --git a/packages/react/src/lib/components/Plots/Bar/GroupedBar/__snapshots__/GroupedBar.unit.tsx.snap b/packages/react/src/lib/components/Plots/Bar/GroupedBar/__snapshots__/GroupedBar.unit.tsx.snap index 8a77208f..1f7a6240 100644 --- a/packages/react/src/lib/components/Plots/Bar/GroupedBar/__snapshots__/GroupedBar.unit.tsx.snap +++ b/packages/react/src/lib/components/Plots/Bar/GroupedBar/__snapshots__/GroupedBar.unit.tsx.snap @@ -5,6 +5,7 @@ exports[`GroupedColumn using SVG should render correctly 1`] = ` @@ -62,6 +64,7 @@ exports[`GroupedColumn using SVG should skip rendering if there is no y scale av diff --git a/packages/react/src/lib/components/Plots/Bar/StackedBar/__snapshots__/StackedBar.unit.tsx.snap b/packages/react/src/lib/components/Plots/Bar/StackedBar/__snapshots__/StackedBar.unit.tsx.snap index f3097951..4caeb760 100644 --- a/packages/react/src/lib/components/Plots/Bar/StackedBar/__snapshots__/StackedBar.unit.tsx.snap +++ b/packages/react/src/lib/components/Plots/Bar/StackedBar/__snapshots__/StackedBar.unit.tsx.snap @@ -5,6 +5,7 @@ exports[`StackedBar using SVG should render correctly 1`] = ` @@ -62,6 +64,7 @@ exports[`StackedBar using SVG should skip rendering if there is no y scale avali diff --git a/packages/react/src/lib/components/Plots/Bar/__snapshots__/Bars.unit.tsx.snap b/packages/react/src/lib/components/Plots/Bar/__snapshots__/Bars.unit.tsx.snap index 7ead4b52..a7da2e11 100644 --- a/packages/react/src/lib/components/Plots/Bar/__snapshots__/Bars.unit.tsx.snap +++ b/packages/react/src/lib/components/Plots/Bar/__snapshots__/Bars.unit.tsx.snap @@ -5,6 +5,7 @@ exports[`Bars Grouped using SVG should render correctly 1`] = ` @@ -42,6 +44,7 @@ exports[`Column using SVG should skip rendering if there is no y scale avaliable diff --git a/packages/react/src/lib/components/Plots/Column/GroupedColumn/__snapshots__/GroupedColumn.unit.tsx.snap b/packages/react/src/lib/components/Plots/Column/GroupedColumn/__snapshots__/GroupedColumn.unit.tsx.snap index 368f500b..efc8f073 100644 --- a/packages/react/src/lib/components/Plots/Column/GroupedColumn/__snapshots__/GroupedColumn.unit.tsx.snap +++ b/packages/react/src/lib/components/Plots/Column/GroupedColumn/__snapshots__/GroupedColumn.unit.tsx.snap @@ -5,6 +5,7 @@ exports[`GroupedColumn using SVG should render correctly 1`] = ` @@ -62,6 +64,7 @@ exports[`GroupedColumn using SVG should skip rendering if there is no y scale av diff --git a/packages/react/src/lib/components/Plots/Column/StackedColumn/__snapshots__/StackedColumn.unit.tsx.snap b/packages/react/src/lib/components/Plots/Column/StackedColumn/__snapshots__/StackedColumn.unit.tsx.snap index 5e8edc91..c3ed5633 100644 --- a/packages/react/src/lib/components/Plots/Column/StackedColumn/__snapshots__/StackedColumn.unit.tsx.snap +++ b/packages/react/src/lib/components/Plots/Column/StackedColumn/__snapshots__/StackedColumn.unit.tsx.snap @@ -5,6 +5,7 @@ exports[`StackedColumn using SVG should render correctly 1`] = ` @@ -62,6 +64,7 @@ exports[`StackedColumn using SVG should skip rendering if there is no y scale av diff --git a/packages/react/src/lib/components/Plots/Column/__snapshots__/Columns.unit.tsx.snap b/packages/react/src/lib/components/Plots/Column/__snapshots__/Columns.unit.tsx.snap index a17e100e..eeb037b1 100644 --- a/packages/react/src/lib/components/Plots/Column/__snapshots__/Columns.unit.tsx.snap +++ b/packages/react/src/lib/components/Plots/Column/__snapshots__/Columns.unit.tsx.snap @@ -5,6 +5,7 @@ exports[`Columns Grouped using SVG should render correctly 1`] = ` @@ -36,6 +38,7 @@ exports[`Line using SVG should skip rendering if there is no y scale avaliable 1 diff --git a/packages/react/src/lib/components/Plots/Line/__snapshots__/Lines.unit.tsx.snap b/packages/react/src/lib/components/Plots/Line/__snapshots__/Lines.unit.tsx.snap index fb1cd144..a4f46343 100644 --- a/packages/react/src/lib/components/Plots/Line/__snapshots__/Lines.unit.tsx.snap +++ b/packages/react/src/lib/components/Plots/Line/__snapshots__/Lines.unit.tsx.snap @@ -5,6 +5,7 @@ exports[`Lines Multiple Series using SVG should render correctly 1`] = ` @@ -40,6 +42,7 @@ exports[`Scatter using SVG should skip rendering if there is no y scale avaliabl diff --git a/packages/react/src/lib/components/Plots/Scatter/__snapshots__/Scatters.unit.tsx.snap b/packages/react/src/lib/components/Plots/Scatter/__snapshots__/Scatters.unit.tsx.snap index 0e4fee93..46bea678 100644 --- a/packages/react/src/lib/components/Plots/Scatter/__snapshots__/Scatters.unit.tsx.snap +++ b/packages/react/src/lib/components/Plots/Scatter/__snapshots__/Scatters.unit.tsx.snap @@ -5,6 +5,7 @@ exports[`Scatters using SVG should render correctly 1`] = ` ({ chart: { - ...defaultChartState, + ...{ ...defaultChartState, id: "test" }, ...(state.chart ?? {}), }, event: {