1
+ /* eslint-disable react/no-multi-comp */
1
2
import React from "react" ;
2
- import { VictoryAxis } from "victory-axis" ;
3
3
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" ;
5
10
6
11
describe ( "helpers/wrapper" , ( ) => {
7
12
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 /> ;
11
16
const childComponents = [ victoryLine , xAxis , yAxis ] ;
12
17
13
18
it ( "calculates a domain from props" , ( ) => {
@@ -32,7 +37,7 @@ describe("helpers/wrapper", () => {
32
37
{ x : "cat" , y : 3 } ,
33
38
] ,
34
39
} ;
35
- const childComponents = [ < VictoryLine key = { 0 } { ...props } /> ] ;
40
+ const childComponents = [ < MockVictoryLine key = { 0 } { ...props } /> ] ;
36
41
const dataStrings = Wrapper . getStringsFromData ( childComponents ) . x ;
37
42
expect ( dataStrings ) . toEqual ( [ "one" , "red" , "cat" ] ) ;
38
43
} ) ;
@@ -47,7 +52,7 @@ describe("helpers/wrapper", () => {
47
52
x : 0 ,
48
53
y : 1 ,
49
54
} ;
50
- const childComponents = [ < VictoryLine key = { 0 } { ...props } /> ] ;
55
+ const childComponents = [ < MockVictoryLine key = { 0 } { ...props } /> ] ;
51
56
const dataStrings = Wrapper . getStringsFromData ( childComponents ) . x ;
52
57
expect ( dataStrings ) . toEqual ( [ "one" , "red" , "cat" ] ) ;
53
58
} ) ;
@@ -59,7 +64,7 @@ describe("helpers/wrapper", () => {
59
64
{ x : "three" , y : 3 } ,
60
65
] ,
61
66
} ;
62
- const childComponents = [ < VictoryLine key = { 0 } { ...props } /> ] ;
67
+ const childComponents = [ < MockVictoryLine key = { 0 } { ...props } /> ] ;
63
68
expect ( Wrapper . getStringsFromData ( childComponents ) . x ) . toEqual ( [ "three" ] ) ;
64
69
} ) ;
65
70
@@ -70,7 +75,7 @@ describe("helpers/wrapper", () => {
70
75
{ x : 3 , y : 3 } ,
71
76
] ,
72
77
} ;
73
- const childComponents = [ < VictoryLine key = { 0 } { ...props } /> ] ;
78
+ const childComponents = [ < MockVictoryLine key = { 0 } { ...props } /> ] ;
74
79
expect ( Wrapper . getStringsFromData ( childComponents ) . x ) . toEqual ( [ ] ) ;
75
80
} ) ;
76
81
0 commit comments