Skip to content

Commit 9faad13

Browse files
authored
Remove cyclic deps from tests (#2795)
1 parent 3dee0b6 commit 9faad13

File tree

13 files changed

+41
-88
lines changed

13 files changed

+41
-88
lines changed

packages/victory-axis/package.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"react": ">=16.6.0"
2828
},
2929
"devDependencies": {
30-
"victory-axis": "*",
31-
"victory-chart": "*"
30+
"victory-axis": "*"
3231
},
3332
"publishConfig": {
3433
"provenance": true
@@ -174,7 +173,6 @@
174173
"dependencies": [
175174
"types:create",
176175
"../victory-core:types:create",
177-
"../victory-chart:types:create",
178176
"../victory-vendor:types:create",
179177
"../victory-voronoi:types:create"
180178
],
@@ -240,7 +238,6 @@
240238
"output": [],
241239
"dependencies": [
242240
"../victory-core:types:create",
243-
"../victory-chart:types:create",
244241
"../victory-vendor:types:create",
245242
"../victory-voronoi:types:create"
246243
],
@@ -258,7 +255,6 @@
258255
"output": [],
259256
"dependencies": [
260257
"../victory-core:types:create",
261-
"../victory-chart:types:create",
262258
"../victory-vendor:types:create",
263259
"../victory-voronoi:types:create"
264260
],
@@ -277,7 +273,6 @@
277273
"output": [],
278274
"dependencies": [
279275
"build:lib:cjs",
280-
"../victory-chart:build:lib:cjs",
281276
"../victory-vendor:build:lib:cjs",
282277
"../victory-voronoi:build:lib:cjs"
283278
],

packages/victory-axis/src/victory-axis.test.tsx

-20
This file was deleted.

packages/victory-box-plot/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"devDependencies": {
3131
"victory-box-plot": "*",
32-
"victory-chart": "^36.9.1"
32+
"victory-chart": "*"
3333
},
3434
"publishConfig": {
3535
"provenance": true

packages/victory-candlestick/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"react": ">=16.6.0"
2828
},
2929
"devDependencies": {
30-
"victory-vendor": "^36.9.1",
31-
"victory-chart": "^36.9.1",
30+
"victory-vendor": "*",
31+
"victory-chart": "*",
3232
"victory-candlestick": "*"
3333
},
3434
"publishConfig": {

packages/victory-chart/package.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
"react": ">=16.6.0"
3232
},
3333
"devDependencies": {
34-
"victory-chart": "*",
35-
"victory-line": "*"
34+
"victory-chart": "*"
3635
},
3736
"publishConfig": {
3837
"provenance": true
@@ -193,7 +192,6 @@
193192
"../victory-core:types:create",
194193
"../victory-polar-axis:types:create",
195194
"../victory-shared-events:types:create",
196-
"../victory-line:types:create",
197195
"../victory-vendor:types:create",
198196
"../victory-voronoi:types:create"
199197
],
@@ -265,7 +263,6 @@
265263
"../victory-core:types:create",
266264
"../victory-polar-axis:types:create",
267265
"../victory-shared-events:types:create",
268-
"../victory-line:types:create",
269266
"../victory-vendor:types:create",
270267
"../victory-voronoi:types:create"
271268
],
@@ -286,7 +283,6 @@
286283
"../victory-core:types:create",
287284
"../victory-polar-axis:types:create",
288285
"../victory-shared-events:types:create",
289-
"../victory-line:types:create",
290286
"../victory-vendor:types:create",
291287
"../victory-voronoi:types:create"
292288
],
@@ -305,7 +301,6 @@
305301
"output": [],
306302
"dependencies": [
307303
"build:lib:cjs",
308-
"../victory-line:build:lib:cjs",
309304
"../victory-vendor:build:lib:cjs",
310305
"../victory-voronoi:build:lib:cjs"
311306
],

packages/victory-chart/src/helper-methods.test.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { getChildComponents } from "victory-chart/lib/helper-methods";
22
import React from "react";
33
import { VictoryAxis } from "victory-axis";
4-
import { VictoryLine } from "victory-line";
4+
5+
const MockVictoryLine = () => <div data-testid="victory-line" />;
56

67
describe("victory-chart/helpers-methods", () => {
78
describe("getChildComponents", () => {
@@ -18,7 +19,7 @@ describe("victory-chart/helpers-methods", () => {
1819
});
1920

2021
it("adds default axes when none of the children are axis components", () => {
21-
const line = <VictoryLine />;
22+
const line = <MockVictoryLine />;
2223
const children = [line];
2324
const result = getChildComponents({ children }, defaultAxes);
2425
expect(result).toHaveLength(3);

packages/victory-chart/src/victory-chart.test.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from "react";
22
import { VictoryChart } from "victory-chart";
33
import { VictoryAxis } from "victory-axis";
4-
import { VictoryLine } from "victory-line";
54
import { render, screen, fireEvent } from "@testing-library/react";
65

76
describe("components/victory-chart", () => {
@@ -103,9 +102,7 @@ describe("components/victory-chart", () => {
103102
describe("animation", () => {
104103
it("handles basic animation parameters without crashing", () => {
105104
const { container } = render(
106-
<VictoryChart animate={{ duration: 2000, easing: "bounce" }}>
107-
<VictoryLine />
108-
</VictoryChart>,
105+
<VictoryChart animate={{ duration: 2000, easing: "bounce" }} />,
109106
);
110107

111108
expect(container.querySelector("svg")).toBeInTheDocument();

packages/victory-core/package.json

+1-16
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@
2828
"react": ">=16.6.0"
2929
},
3030
"devDependencies": {
31-
"victory-axis": "*",
32-
"victory-bar": "*",
33-
"victory-core": "*",
34-
"victory-line": "*"
31+
"victory-core": "*"
3532
},
3633
"publishConfig": {
3734
"provenance": true
@@ -177,9 +174,6 @@
177174
"dependencies": [
178175
"types:create",
179176
"../victory-vendor:types:create",
180-
"../victory-axis:types:create",
181-
"../victory-bar:types:create",
182-
"../victory-line:types:create",
183177
"../victory-voronoi:types:create"
184178
],
185179
"output": [],
@@ -245,9 +239,6 @@
245239
"dependencies": [
246240
"../victory-vendor:build",
247241
"../victory-vendor:types:create",
248-
"../victory-axis:types:create",
249-
"../victory-bar:types:create",
250-
"../victory-line:types:create",
251242
"../victory-voronoi:types:create"
252243
],
253244
"packageLocks": [
@@ -265,9 +256,6 @@
265256
"dependencies": [
266257
"../victory-vendor:build",
267258
"../victory-vendor:types:create",
268-
"../victory-axis:types:create",
269-
"../victory-bar:types:create",
270-
"../victory-line:types:create",
271259
"../victory-voronoi:types:create"
272260
],
273261
"packageLocks": [
@@ -285,9 +273,6 @@
285273
"output": [],
286274
"dependencies": [
287275
"build:lib:cjs",
288-
"../victory-axis:build:lib:cjs",
289-
"../victory-bar:build:lib:cjs",
290-
"../victory-line:build:lib:cjs",
291276
"../victory-vendor:build:lib:cjs",
292277
"../victory-voronoi:build:lib:cjs"
293278
],

packages/victory-core/src/victory-util/axis.test.tsx

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1+
/* eslint-disable react/no-multi-comp */
12
import React from "react";
2-
import { VictoryAxis } from "victory-axis";
3-
import { VictoryBar } from "victory-bar";
43
import { Axis, Scale } from "victory-core";
54

65
describe("helpers/axis", () => {
@@ -67,9 +66,15 @@ describe("helpers/axis", () => {
6766
});
6867

6968
describe("getAxisComponent", () => {
70-
const dependentAxis = <VictoryAxis dependentAxis />;
71-
const independentAxis = <VictoryAxis dependentAxis={false} />;
72-
const bar = <VictoryBar />;
69+
const MockVictoryAxis = (props) => <div {...props} />;
70+
MockVictoryAxis.getAxis = (props) => (props.dependentAxis ? "y" : "x");
71+
MockVictoryAxis.role = "axis";
72+
73+
const MockVictoryBar = (props) => <div {...props} />;
74+
75+
const dependentAxis = <MockVictoryAxis dependentAxis />;
76+
const independentAxis = <MockVictoryAxis dependentAxis={false} />;
77+
const bar = <MockVictoryBar />;
7378

7479
beforeEach(() => {
7580
jest.spyOn(dependentAxis.type, "getAxis");

packages/victory-core/src/victory-util/wrapper.test.tsx

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1+
/* eslint-disable react/no-multi-comp */
12
import React from "react";
2-
import { VictoryAxis } from "victory-axis";
33
import { Wrapper } from "victory-core";
4-
import { VictoryLine } from "victory-line";
4+
5+
const MockVictoryAxis = (props) => <div {...props} />;
6+
MockVictoryAxis.role = "axis";
7+
8+
const MockVictoryLine = (props) => <div {...props} />;
9+
MockVictoryLine.role = "line";
510

611
describe("helpers/wrapper", () => {
712
describe("getDomain", () => {
8-
const victoryLine = <VictoryLine domain={[0, 3]} />;
9-
const xAxis = <VictoryAxis dependentAxis={false} />;
10-
const yAxis = <VictoryAxis dependentAxis />;
13+
const victoryLine = <MockVictoryLine domain={[0, 3]} />;
14+
const xAxis = <MockVictoryAxis dependentAxis={false} />;
15+
const yAxis = <MockVictoryAxis dependentAxis />;
1116
const childComponents = [victoryLine, xAxis, yAxis];
1217

1318
it("calculates a domain from props", () => {
@@ -32,7 +37,7 @@ describe("helpers/wrapper", () => {
3237
{ x: "cat", y: 3 },
3338
],
3439
};
35-
const childComponents = [<VictoryLine key={0} {...props} />];
40+
const childComponents = [<MockVictoryLine key={0} {...props} />];
3641
const dataStrings = Wrapper.getStringsFromData(childComponents).x;
3742
expect(dataStrings).toEqual(["one", "red", "cat"]);
3843
});
@@ -47,7 +52,7 @@ describe("helpers/wrapper", () => {
4752
x: 0,
4853
y: 1,
4954
};
50-
const childComponents = [<VictoryLine key={0} {...props} />];
55+
const childComponents = [<MockVictoryLine key={0} {...props} />];
5156
const dataStrings = Wrapper.getStringsFromData(childComponents).x;
5257
expect(dataStrings).toEqual(["one", "red", "cat"]);
5358
});
@@ -59,7 +64,7 @@ describe("helpers/wrapper", () => {
5964
{ x: "three", y: 3 },
6065
],
6166
};
62-
const childComponents = [<VictoryLine key={0} {...props} />];
67+
const childComponents = [<MockVictoryLine key={0} {...props} />];
6368
expect(Wrapper.getStringsFromData(childComponents).x).toEqual(["three"]);
6469
});
6570

@@ -70,7 +75,7 @@ describe("helpers/wrapper", () => {
7075
{ x: 3, y: 3 },
7176
],
7277
};
73-
const childComponents = [<VictoryLine key={0} {...props} />];
78+
const childComponents = [<MockVictoryLine key={0} {...props} />];
7479
expect(Wrapper.getStringsFromData(childComponents).x).toEqual([]);
7580
});
7681

packages/victory-native/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"react-native": "^0.65.1",
6060
"react-native-gesture-handler": "^1.10.3",
6161
"react-native-svg": "^12.4.3",
62-
"victory-native": "*"
62+
"victory-native": "^36.9.1"
6363
},
6464
"peerDependencies": {
6565
"react": ">=16.6.0"

packages/victory-selection-container/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"react": ">=16.6.0"
2828
},
2929
"devDependencies": {
30-
"victory-bar": "^36.9.1",
30+
"victory-bar": "*",
3131
"victory-selection-container": "*"
3232
},
3333
"publishConfig": {

0 commit comments

Comments
 (0)