Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove cyclic deps from tests #2795

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 1 addition & 6 deletions packages/victory-axis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
"react": ">=16.6.0"
},
"devDependencies": {
"victory-axis": "*",
"victory-chart": "*"
"victory-axis": "*"
},
"publishConfig": {
"provenance": true
Expand Down Expand Up @@ -174,7 +173,6 @@
"dependencies": [
"types:create",
"../victory-core:types:create",
"../victory-chart:types:create",
"../victory-vendor:types:create",
"../victory-voronoi:types:create"
],
Expand Down Expand Up @@ -240,7 +238,6 @@
"output": [],
"dependencies": [
"../victory-core:types:create",
"../victory-chart:types:create",
"../victory-vendor:types:create",
"../victory-voronoi:types:create"
],
Expand All @@ -258,7 +255,6 @@
"output": [],
"dependencies": [
"../victory-core:types:create",
"../victory-chart:types:create",
"../victory-vendor:types:create",
"../victory-voronoi:types:create"
],
Expand All @@ -277,7 +273,6 @@
"output": [],
"dependencies": [
"build:lib:cjs",
"../victory-chart:build:lib:cjs",
"../victory-vendor:build:lib:cjs",
"../victory-voronoi:build:lib:cjs"
],
Expand Down
20 changes: 0 additions & 20 deletions packages/victory-axis/src/victory-axis.test.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion packages/victory-box-plot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"devDependencies": {
"victory-box-plot": "*",
"victory-chart": "^36.9.1"
"victory-chart": "*"
},
"publishConfig": {
"provenance": true
Expand Down
4 changes: 2 additions & 2 deletions packages/victory-candlestick/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"react": ">=16.6.0"
},
"devDependencies": {
"victory-vendor": "^36.9.1",
"victory-chart": "^36.9.1",
"victory-vendor": "*",
"victory-chart": "*",
"victory-candlestick": "*"
},
"publishConfig": {
Expand Down
7 changes: 1 addition & 6 deletions packages/victory-chart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
"react": ">=16.6.0"
},
"devDependencies": {
"victory-chart": "*",
"victory-line": "*"
"victory-chart": "*"
},
"publishConfig": {
"provenance": true
Expand Down Expand Up @@ -193,7 +192,6 @@
"../victory-core:types:create",
"../victory-polar-axis:types:create",
"../victory-shared-events:types:create",
"../victory-line:types:create",
"../victory-vendor:types:create",
"../victory-voronoi:types:create"
],
Expand Down Expand Up @@ -265,7 +263,6 @@
"../victory-core:types:create",
"../victory-polar-axis:types:create",
"../victory-shared-events:types:create",
"../victory-line:types:create",
"../victory-vendor:types:create",
"../victory-voronoi:types:create"
],
Expand All @@ -286,7 +283,6 @@
"../victory-core:types:create",
"../victory-polar-axis:types:create",
"../victory-shared-events:types:create",
"../victory-line:types:create",
"../victory-vendor:types:create",
"../victory-voronoi:types:create"
],
Expand All @@ -305,7 +301,6 @@
"output": [],
"dependencies": [
"build:lib:cjs",
"../victory-line:build:lib:cjs",
"../victory-vendor:build:lib:cjs",
"../victory-voronoi:build:lib:cjs"
],
Expand Down
5 changes: 3 additions & 2 deletions packages/victory-chart/src/helper-methods.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { getChildComponents } from "victory-chart/lib/helper-methods";
import React from "react";
import { VictoryAxis } from "victory-axis";
import { VictoryLine } from "victory-line";

const MockVictoryLine = () => <div data-testid="victory-line" />;

describe("victory-chart/helpers-methods", () => {
describe("getChildComponents", () => {
Expand All @@ -18,7 +19,7 @@ describe("victory-chart/helpers-methods", () => {
});

it("adds default axes when none of the children are axis components", () => {
const line = <VictoryLine />;
const line = <MockVictoryLine />;
const children = [line];
const result = getChildComponents({ children }, defaultAxes);
expect(result).toHaveLength(3);
Expand Down
5 changes: 1 addition & 4 deletions packages/victory-chart/src/victory-chart.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";
import { VictoryChart } from "victory-chart";
import { VictoryAxis } from "victory-axis";
import { VictoryLine } from "victory-line";
import { render, screen, fireEvent } from "@testing-library/react";

describe("components/victory-chart", () => {
Expand Down Expand Up @@ -103,9 +102,7 @@ describe("components/victory-chart", () => {
describe("animation", () => {
it("handles basic animation parameters without crashing", () => {
const { container } = render(
<VictoryChart animate={{ duration: 2000, easing: "bounce" }}>
<VictoryLine />
</VictoryChart>,
<VictoryChart animate={{ duration: 2000, easing: "bounce" }} />,
);

expect(container.querySelector("svg")).toBeInTheDocument();
Expand Down
17 changes: 1 addition & 16 deletions packages/victory-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@
"react": ">=16.6.0"
},
"devDependencies": {
"victory-axis": "*",
"victory-bar": "*",
"victory-core": "*",
"victory-line": "*"
"victory-core": "*"
},
"publishConfig": {
"provenance": true
Expand Down Expand Up @@ -177,9 +174,6 @@
"dependencies": [
"types:create",
"../victory-vendor:types:create",
"../victory-axis:types:create",
"../victory-bar:types:create",
"../victory-line:types:create",
"../victory-voronoi:types:create"
],
"output": [],
Expand Down Expand Up @@ -245,9 +239,6 @@
"dependencies": [
"../victory-vendor:build",
"../victory-vendor:types:create",
"../victory-axis:types:create",
"../victory-bar:types:create",
"../victory-line:types:create",
"../victory-voronoi:types:create"
],
"packageLocks": [
Expand All @@ -265,9 +256,6 @@
"dependencies": [
"../victory-vendor:build",
"../victory-vendor:types:create",
"../victory-axis:types:create",
"../victory-bar:types:create",
"../victory-line:types:create",
"../victory-voronoi:types:create"
],
"packageLocks": [
Expand All @@ -285,9 +273,6 @@
"output": [],
"dependencies": [
"build:lib:cjs",
"../victory-axis:build:lib:cjs",
"../victory-bar:build:lib:cjs",
"../victory-line:build:lib:cjs",
"../victory-vendor:build:lib:cjs",
"../victory-voronoi:build:lib:cjs"
],
Expand Down
15 changes: 10 additions & 5 deletions packages/victory-core/src/victory-util/axis.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable react/no-multi-comp */
import React from "react";
import { VictoryAxis } from "victory-axis";
import { VictoryBar } from "victory-bar";
import { Axis, Scale } from "victory-core";

describe("helpers/axis", () => {
Expand Down Expand Up @@ -67,9 +66,15 @@ describe("helpers/axis", () => {
});

describe("getAxisComponent", () => {
const dependentAxis = <VictoryAxis dependentAxis />;
const independentAxis = <VictoryAxis dependentAxis={false} />;
const bar = <VictoryBar />;
const MockVictoryAxis = (props) => <div {...props} />;
MockVictoryAxis.getAxis = (props) => (props.dependentAxis ? "y" : "x");
MockVictoryAxis.role = "axis";

const MockVictoryBar = (props) => <div {...props} />;

const dependentAxis = <MockVictoryAxis dependentAxis />;
const independentAxis = <MockVictoryAxis dependentAxis={false} />;
const bar = <MockVictoryBar />;

beforeEach(() => {
jest.spyOn(dependentAxis.type, "getAxis");
Expand Down
23 changes: 14 additions & 9 deletions packages/victory-core/src/victory-util/wrapper.test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
/* eslint-disable react/no-multi-comp */
import React from "react";
import { VictoryAxis } from "victory-axis";
import { Wrapper } from "victory-core";
import { VictoryLine } from "victory-line";

const MockVictoryAxis = (props) => <div {...props} />;
MockVictoryAxis.role = "axis";

const MockVictoryLine = (props) => <div {...props} />;
MockVictoryLine.role = "line";

describe("helpers/wrapper", () => {
describe("getDomain", () => {
const victoryLine = <VictoryLine domain={[0, 3]} />;
const xAxis = <VictoryAxis dependentAxis={false} />;
const yAxis = <VictoryAxis dependentAxis />;
const victoryLine = <MockVictoryLine domain={[0, 3]} />;
const xAxis = <MockVictoryAxis dependentAxis={false} />;
const yAxis = <MockVictoryAxis dependentAxis />;
const childComponents = [victoryLine, xAxis, yAxis];

it("calculates a domain from props", () => {
Expand All @@ -32,7 +37,7 @@ describe("helpers/wrapper", () => {
{ x: "cat", y: 3 },
],
};
const childComponents = [<VictoryLine key={0} {...props} />];
const childComponents = [<MockVictoryLine key={0} {...props} />];
const dataStrings = Wrapper.getStringsFromData(childComponents).x;
expect(dataStrings).toEqual(["one", "red", "cat"]);
});
Expand All @@ -47,7 +52,7 @@ describe("helpers/wrapper", () => {
x: 0,
y: 1,
};
const childComponents = [<VictoryLine key={0} {...props} />];
const childComponents = [<MockVictoryLine key={0} {...props} />];
const dataStrings = Wrapper.getStringsFromData(childComponents).x;
expect(dataStrings).toEqual(["one", "red", "cat"]);
});
Expand All @@ -59,7 +64,7 @@ describe("helpers/wrapper", () => {
{ x: "three", y: 3 },
],
};
const childComponents = [<VictoryLine key={0} {...props} />];
const childComponents = [<MockVictoryLine key={0} {...props} />];
expect(Wrapper.getStringsFromData(childComponents).x).toEqual(["three"]);
});

Expand All @@ -70,7 +75,7 @@ describe("helpers/wrapper", () => {
{ x: 3, y: 3 },
],
};
const childComponents = [<VictoryLine key={0} {...props} />];
const childComponents = [<MockVictoryLine key={0} {...props} />];
expect(Wrapper.getStringsFromData(childComponents).x).toEqual([]);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/victory-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"react-native": "^0.65.1",
"react-native-gesture-handler": "^1.10.3",
"react-native-svg": "^12.4.3",
"victory-native": "*"
"victory-native": "^36.9.1"
},
"peerDependencies": {
"react": ">=16.6.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-selection-container/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"react": ">=16.6.0"
},
"devDependencies": {
"victory-bar": "^36.9.1",
"victory-bar": "*",
"victory-selection-container": "*"
},
"publishConfig": {
Expand Down