@pie-lib/graphing 4.1.0-beta.7 → 4.1.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/lib/__tests__/bg.test.js +0 -282
- package/lib/__tests__/bg.test.js.map +0 -1
- package/lib/__tests__/coordinates-label.test.js +0 -276
- package/lib/__tests__/coordinates-label.test.js.map +0 -1
- package/lib/__tests__/graph-with-controls.test.js +0 -275
- package/lib/__tests__/graph-with-controls.test.js.map +0 -1
- package/lib/__tests__/graph.test.js +0 -927
- package/lib/__tests__/graph.test.js.map +0 -1
- package/lib/__tests__/grid-setup.test.js +0 -729
- package/lib/__tests__/grid-setup.test.js.map +0 -1
- package/lib/__tests__/grid.test.js +0 -29
- package/lib/__tests__/grid.test.js.map +0 -1
- package/lib/__tests__/key-legend.test.js +0 -321
- package/lib/__tests__/key-legend.test.js.map +0 -1
- package/lib/__tests__/label-svg-icon.test.js +0 -373
- package/lib/__tests__/label-svg-icon.test.js.map +0 -1
- package/lib/__tests__/labels.test.js +0 -61
- package/lib/__tests__/labels.test.js.map +0 -1
- package/lib/__tests__/mark-label.test.js +0 -133
- package/lib/__tests__/mark-label.test.js.map +0 -1
- package/lib/__tests__/toggle-bar.test.js +0 -197
- package/lib/__tests__/toggle-bar.test.js.map +0 -1
- package/lib/__tests__/tool-menu.test.js +0 -151
- package/lib/__tests__/tool-menu.test.js.map +0 -1
- package/lib/__tests__/undo-redo.test.js +0 -31
- package/lib/__tests__/undo-redo.test.js.map +0 -1
- package/lib/__tests__/use-debounce.test.js +0 -24
- package/lib/__tests__/use-debounce.test.js.map +0 -1
- package/lib/__tests__/utils.js +0 -70
- package/lib/__tests__/utils.js.map +0 -1
- package/lib/__tests__/utils.test.js +0 -123
- package/lib/__tests__/utils.test.js.map +0 -1
- package/lib/axis/__tests__/arrow.test.js +0 -60
- package/lib/axis/__tests__/arrow.test.js.map +0 -1
- package/lib/axis/__tests__/axes.test.js +0 -195
- package/lib/axis/__tests__/axes.test.js.map +0 -1
- package/lib/container/__tests__/actions.test.js +0 -108
- package/lib/container/__tests__/actions.test.js.map +0 -1
- package/lib/container/__tests__/index.test.js +0 -503
- package/lib/container/__tests__/index.test.js.map +0 -1
- package/lib/container/__tests__/marks.test.js +0 -259
- package/lib/container/__tests__/marks.test.js.map +0 -1
- package/lib/container/__tests__/middleware.test.js +0 -244
- package/lib/container/__tests__/middleware.test.js.map +0 -1
- package/lib/container/__tests__/reducer.test.js +0 -450
- package/lib/container/__tests__/reducer.test.js.map +0 -1
- package/lib/tools/absolute/__tests__/component.test.js +0 -65
- package/lib/tools/absolute/__tests__/component.test.js.map +0 -1
- package/lib/tools/circle/__tests__/bg-circle.test.js +0 -33
- package/lib/tools/circle/__tests__/bg-circle.test.js.map +0 -1
- package/lib/tools/circle/__tests__/component.test.js +0 -615
- package/lib/tools/circle/__tests__/component.test.js.map +0 -1
- package/lib/tools/circle/__tests__/index.test.js +0 -576
- package/lib/tools/circle/__tests__/index.test.js.map +0 -1
- package/lib/tools/exponential/__tests__/component.test.js +0 -64
- package/lib/tools/exponential/__tests__/component.test.js.map +0 -1
- package/lib/tools/exponential/__tests__/index.test.js +0 -828
- package/lib/tools/exponential/__tests__/index.test.js.map +0 -1
- package/lib/tools/line/__tests__/component.test.js +0 -45
- package/lib/tools/line/__tests__/component.test.js.map +0 -1
- package/lib/tools/parabola/__tests__/component.test.js +0 -64
- package/lib/tools/parabola/__tests__/component.test.js.map +0 -1
- package/lib/tools/parabola/__tests__/index.test.js +0 -564
- package/lib/tools/parabola/__tests__/index.test.js.map +0 -1
- package/lib/tools/point/__tests__/component.test.js +0 -434
- package/lib/tools/point/__tests__/component.test.js.map +0 -1
- package/lib/tools/point/__tests__/index.test.js +0 -262
- package/lib/tools/point/__tests__/index.test.js.map +0 -1
- package/lib/tools/polygon/__tests__/component.test.js +0 -485
- package/lib/tools/polygon/__tests__/component.test.js.map +0 -1
- package/lib/tools/polygon/__tests__/index.test.js +0 -303
- package/lib/tools/polygon/__tests__/index.test.js.map +0 -1
- package/lib/tools/polygon/__tests__/line.test.js +0 -50
- package/lib/tools/polygon/__tests__/line.test.js.map +0 -1
- package/lib/tools/polygon/__tests__/polygon.test.js +0 -85
- package/lib/tools/polygon/__tests__/polygon.test.js.map +0 -1
- package/lib/tools/ray/__tests__/component.test.js +0 -35
- package/lib/tools/ray/__tests__/component.test.js.map +0 -1
- package/lib/tools/segment/__tests__/component.test.js +0 -35
- package/lib/tools/segment/__tests__/component.test.js.map +0 -1
- package/lib/tools/shared/__tests__/arrow-head.test.js +0 -45
- package/lib/tools/shared/__tests__/arrow-head.test.js.map +0 -1
- package/lib/tools/shared/line/__tests__/index.test.js +0 -124
- package/lib/tools/shared/line/__tests__/index.test.js.map +0 -1
- package/lib/tools/shared/line/__tests__/line-path.test.js +0 -62
- package/lib/tools/shared/line/__tests__/line-path.test.js.map +0 -1
- package/lib/tools/shared/line/__tests__/with-root-edge.test.js +0 -90
- package/lib/tools/shared/line/__tests__/with-root-edge.test.js.map +0 -1
- package/lib/tools/shared/point/__tests__/arrow-point.test.js +0 -127
- package/lib/tools/shared/point/__tests__/arrow-point.test.js.map +0 -1
- package/lib/tools/shared/point/__tests__/base-point.test.js +0 -122
- package/lib/tools/shared/point/__tests__/base-point.test.js.map +0 -1
- package/lib/tools/sine/__tests__/component.test.js +0 -72
- package/lib/tools/sine/__tests__/component.test.js.map +0 -1
- package/lib/tools/vector/__tests__/component.test.js +0 -32
- package/lib/tools/vector/__tests__/component.test.js.map +0 -1
- package/src/__tests__/bg.test.jsx +0 -250
- package/src/__tests__/coordinates-label.test.jsx +0 -243
- package/src/__tests__/graph-with-controls.test.jsx +0 -198
- package/src/__tests__/graph.test.jsx +0 -721
- package/src/__tests__/grid-setup.test.jsx +0 -645
- package/src/__tests__/grid.test.jsx +0 -22
- package/src/__tests__/key-legend.test.jsx +0 -260
- package/src/__tests__/label-svg-icon.test.jsx +0 -278
- package/src/__tests__/labels.test.jsx +0 -55
- package/src/__tests__/mark-label.test.jsx +0 -63
- package/src/__tests__/toggle-bar.test.jsx +0 -146
- package/src/__tests__/tool-menu.test.jsx +0 -115
- package/src/__tests__/undo-redo.test.jsx +0 -24
- package/src/__tests__/use-debounce.test.js +0 -21
- package/src/__tests__/utils.js +0 -41
- package/src/__tests__/utils.test.js +0 -105
- package/src/axis/__tests__/arrow.test.jsx +0 -38
- package/src/axis/__tests__/axes.test.jsx +0 -216
- package/src/container/__tests__/actions.test.js +0 -105
- package/src/container/__tests__/index.test.jsx +0 -319
- package/src/container/__tests__/marks.test.js +0 -172
- package/src/container/__tests__/middleware.test.js +0 -235
- package/src/container/__tests__/reducer.test.js +0 -324
- package/src/tools/absolute/__tests__/component.test.jsx +0 -53
- package/src/tools/circle/__tests__/bg-circle.test.jsx +0 -26
- package/src/tools/circle/__tests__/component.test.jsx +0 -494
- package/src/tools/circle/__tests__/index.test.js +0 -480
- package/src/tools/exponential/__tests__/component.test.jsx +0 -53
- package/src/tools/exponential/__tests__/index.test.js +0 -729
- package/src/tools/line/__tests__/component.test.jsx +0 -37
- package/src/tools/parabola/__tests__/component.test.jsx +0 -48
- package/src/tools/parabola/__tests__/index.test.js +0 -470
- package/src/tools/point/__tests__/component.test.jsx +0 -349
- package/src/tools/point/__tests__/index.test.js +0 -241
- package/src/tools/polygon/__tests__/component.test.jsx +0 -471
- package/src/tools/polygon/__tests__/index.test.js +0 -294
- package/src/tools/polygon/__tests__/line.test.jsx +0 -35
- package/src/tools/polygon/__tests__/polygon.test.jsx +0 -61
- package/src/tools/ray/__tests__/component.test.jsx +0 -29
- package/src/tools/segment/__tests__/component.test.jsx +0 -28
- package/src/tools/shared/__tests__/arrow-head.test.jsx +0 -31
- package/src/tools/shared/line/__tests__/index.test.jsx +0 -109
- package/src/tools/shared/line/__tests__/line-path.test.jsx +0 -53
- package/src/tools/shared/line/__tests__/with-root-edge.test.jsx +0 -73
- package/src/tools/shared/point/__tests__/arrow-point.test.jsx +0 -91
- package/src/tools/shared/point/__tests__/base-point.test.jsx +0 -87
- package/src/tools/sine/__tests__/component.test.jsx +0 -51
- package/src/tools/vector/__tests__/component.test.jsx +0 -25
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { render } from '@pie-lib/test-utils';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { rootEdgeComponent, rootEdgeToFromToWrapper } from '../with-root-edge';
|
|
4
|
-
import { graphProps as getGraphProps } from '../../../../__tests__/utils';
|
|
5
|
-
import { utils } from '@pie-lib/plot';
|
|
6
|
-
|
|
7
|
-
const { xy } = utils;
|
|
8
|
-
jest.mock('../index', () => {
|
|
9
|
-
const out = {
|
|
10
|
-
lineBase: jest.fn().mockReturnValue(() => <div />),
|
|
11
|
-
lineToolComponent: jest.fn().mockReturnValue(() => <div />),
|
|
12
|
-
};
|
|
13
|
-
return out;
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
describe('rootEdgeToToFromWrapper', () => {
|
|
17
|
-
let Comp;
|
|
18
|
-
let onChange = jest.fn();
|
|
19
|
-
beforeEach(() => {
|
|
20
|
-
Comp = rootEdgeToFromToWrapper(() => <div />);
|
|
21
|
-
});
|
|
22
|
-
const renderComponent = (extras) => {
|
|
23
|
-
const defaults = {
|
|
24
|
-
mark: { root: xy(1, 1), edge: xy(2, 2) },
|
|
25
|
-
onChange,
|
|
26
|
-
};
|
|
27
|
-
const props = { ...defaults, ...extras };
|
|
28
|
-
return render(<Comp {...props} />);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
it('renders without crashing', () => {
|
|
32
|
-
const { container } = renderComponent();
|
|
33
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('passes mark as from/to', () => {
|
|
37
|
-
const { container } = renderComponent();
|
|
38
|
-
// Component transforms root/edge to from/to internally
|
|
39
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('handles onChange with root/edge transformation', () => {
|
|
43
|
-
renderComponent();
|
|
44
|
-
// onChange transformation is tested through component behavior
|
|
45
|
-
expect(onChange).toBeDefined();
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
describe('rootEdgeComponent', () => {
|
|
50
|
-
let onChange = jest.fn();
|
|
51
|
-
let Comp;
|
|
52
|
-
let mark;
|
|
53
|
-
beforeEach(() => {
|
|
54
|
-
mark = { root: xy(0, 0), edge: xy(1, 1) };
|
|
55
|
-
Comp = rootEdgeComponent(() => <text />);
|
|
56
|
-
});
|
|
57
|
-
const renderComponent = (extras) => {
|
|
58
|
-
const defaults = {
|
|
59
|
-
mark,
|
|
60
|
-
graphProps: getGraphProps(),
|
|
61
|
-
onChange,
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const props = { ...defaults, ...extras };
|
|
65
|
-
return render(<Comp {...props} />);
|
|
66
|
-
};
|
|
67
|
-
describe('rendering', () => {
|
|
68
|
-
it('renders without crashing', () => {
|
|
69
|
-
const { container } = renderComponent();
|
|
70
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
});
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { render } from '@pie-lib/test-utils';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { ArrowPoint } from '../index';
|
|
4
|
-
import { graphProps } from '../../../../__tests__/utils';
|
|
5
|
-
import { bounds } from '../../../../utils';
|
|
6
|
-
import { gridDraggable, utils } from '@pie-lib/plot';
|
|
7
|
-
|
|
8
|
-
const { xy } = utils;
|
|
9
|
-
jest.mock('../../../../utils', () => {
|
|
10
|
-
const { point, getAngleDeg, arrowDimensions } = jest.requireActual('../../../../utils');
|
|
11
|
-
return {
|
|
12
|
-
bounds: jest.fn(),
|
|
13
|
-
point,
|
|
14
|
-
getAngleDeg,
|
|
15
|
-
arrowDimensions,
|
|
16
|
-
};
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
jest.mock('@pie-lib/plot', () => {
|
|
20
|
-
const { types, utils } = jest.requireActual('@pie-lib/plot');
|
|
21
|
-
return {
|
|
22
|
-
gridDraggable: jest.fn((opts) => (Comp) => Comp),
|
|
23
|
-
types,
|
|
24
|
-
utils,
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe('ArrowPoint', () => {
|
|
29
|
-
let onChange = jest.fn();
|
|
30
|
-
const renderComponent = (extras) => {
|
|
31
|
-
const defaults = {
|
|
32
|
-
classes: {},
|
|
33
|
-
className: 'className',
|
|
34
|
-
onChange,
|
|
35
|
-
graphProps: graphProps(),
|
|
36
|
-
from: xy(0, 0),
|
|
37
|
-
to: xy(1, 1),
|
|
38
|
-
x: 0,
|
|
39
|
-
y: 0,
|
|
40
|
-
};
|
|
41
|
-
const props = { ...defaults, ...extras };
|
|
42
|
-
return render(<ArrowPoint {...props} />);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
describe('rendering', () => {
|
|
46
|
-
it('renders without crashing', () => {
|
|
47
|
-
const { container } = renderComponent();
|
|
48
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
describe('gridDraggable options', () => {
|
|
53
|
-
let opts;
|
|
54
|
-
let domain;
|
|
55
|
-
let range;
|
|
56
|
-
beforeEach(() => {
|
|
57
|
-
domain = {
|
|
58
|
-
min: 0,
|
|
59
|
-
max: 1,
|
|
60
|
-
step: 1,
|
|
61
|
-
};
|
|
62
|
-
range = {
|
|
63
|
-
min: 0,
|
|
64
|
-
max: 1,
|
|
65
|
-
step: 1,
|
|
66
|
-
};
|
|
67
|
-
renderComponent();
|
|
68
|
-
opts = gridDraggable.mock.calls[gridDraggable.mock.calls.length - 1][0];
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe('bounds', () => {
|
|
72
|
-
it('calls utils.bounds with area', () => {
|
|
73
|
-
const result = opts.bounds({ x: 0, y: 0 }, { domain, range });
|
|
74
|
-
expect(bounds).toHaveBeenCalledWith({ left: 0, top: 0, bottom: 0, right: 0 }, domain, range);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
describe('anchorPoint', () => {
|
|
78
|
-
it('returns x/y', () => {
|
|
79
|
-
const result = opts.anchorPoint({ x: 0, y: 0 });
|
|
80
|
-
expect(result).toEqual({ x: 0, y: 0 });
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
describe('fromDelta', () => {
|
|
85
|
-
it('returns a new point from the x/y + delta', () => {
|
|
86
|
-
const result = opts.fromDelta({ x: -1, y: 0 }, { x: 1, y: 3 });
|
|
87
|
-
expect(result).toEqual({ x: 0, y: 3 });
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
});
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { render } from '@pie-lib/test-utils';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { BasePoint } from '../index';
|
|
4
|
-
import { gridDraggable } from '@pie-lib/plot';
|
|
5
|
-
import { graphProps } from '../../../../__tests__/utils';
|
|
6
|
-
import { bounds } from '../../../../utils';
|
|
7
|
-
|
|
8
|
-
jest.mock('../../../../utils', () => {
|
|
9
|
-
const { point, thinnerShapesNeeded } = jest.requireActual('../../../../utils');
|
|
10
|
-
return {
|
|
11
|
-
bounds: jest.fn(),
|
|
12
|
-
point,
|
|
13
|
-
thinnerShapesNeeded,
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
jest.mock('@pie-lib/plot', () => {
|
|
18
|
-
const { types, utils } = jest.requireActual('@pie-lib/plot');
|
|
19
|
-
return {
|
|
20
|
-
gridDraggable: jest.fn((opts) => (Comp) => Comp),
|
|
21
|
-
types,
|
|
22
|
-
utils,
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('BasePoint', () => {
|
|
27
|
-
let onChange = jest.fn();
|
|
28
|
-
const renderComponent = (extras) => {
|
|
29
|
-
const defaults = {
|
|
30
|
-
classes: {},
|
|
31
|
-
className: 'className',
|
|
32
|
-
onChange,
|
|
33
|
-
graphProps: graphProps(),
|
|
34
|
-
x: 0,
|
|
35
|
-
y: 0,
|
|
36
|
-
};
|
|
37
|
-
const props = { ...defaults, ...extras };
|
|
38
|
-
return render(<BasePoint {...props} />);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
describe('rendering', () => {
|
|
42
|
-
it('renders without crashing', () => {
|
|
43
|
-
const { container } = renderComponent();
|
|
44
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
describe('gridDraggable options', () => {
|
|
49
|
-
let opts;
|
|
50
|
-
let domain;
|
|
51
|
-
let range;
|
|
52
|
-
beforeEach(() => {
|
|
53
|
-
domain = {
|
|
54
|
-
min: 0,
|
|
55
|
-
max: 1,
|
|
56
|
-
step: 1,
|
|
57
|
-
};
|
|
58
|
-
range = {
|
|
59
|
-
min: 0,
|
|
60
|
-
max: 1,
|
|
61
|
-
step: 1,
|
|
62
|
-
};
|
|
63
|
-
renderComponent();
|
|
64
|
-
opts = gridDraggable.mock.calls[gridDraggable.mock.calls.length - 1][0];
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
describe('bounds', () => {
|
|
68
|
-
it('calls utils.bounds with area', () => {
|
|
69
|
-
const result = opts.bounds({ x: 0, y: 0 }, { domain, range });
|
|
70
|
-
expect(bounds).toHaveBeenCalledWith({ left: 0, top: 0, bottom: 0, right: 0 }, domain, range);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
describe('anchorPoint', () => {
|
|
74
|
-
it('returns x/y', () => {
|
|
75
|
-
const result = opts.anchorPoint({ x: 0, y: 0 });
|
|
76
|
-
expect(result).toEqual({ x: 0, y: 0 });
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
describe('fromDelta', () => {
|
|
81
|
-
it('returns a new point from the x/y + delta', () => {
|
|
82
|
-
const result = opts.fromDelta({ x: -1, y: 0 }, { x: 1, y: 3 });
|
|
83
|
-
expect(result).toEqual({ x: 0, y: 3 });
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { withRootEdge } from '../../shared/line/with-root-edge';
|
|
2
|
-
import { buildDataPoints, sinY } from '@pie-lib/graphing-utils';
|
|
3
|
-
import { utils } from '@pie-lib/plot';
|
|
4
|
-
|
|
5
|
-
import { graphProps as getGraphProps } from '../../../__tests__/utils';
|
|
6
|
-
|
|
7
|
-
const { xy } = utils;
|
|
8
|
-
jest.mock('@pie-lib/graphing-utils', () => ({
|
|
9
|
-
sinY: jest.fn().mockReturnValue(0),
|
|
10
|
-
buildDataPoints: jest.fn().mockReturnValue([]),
|
|
11
|
-
parabolaFromTwoPoints: jest.fn(() => jest.fn()),
|
|
12
|
-
getAmplitudeAndFreq: jest.fn().mockReturnValue({ freq: 4, amplitude: 1 }),
|
|
13
|
-
FREQ_DIVIDER: 16,
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
jest.mock('../../shared/line/with-root-edge', () => ({
|
|
17
|
-
withRootEdge: jest.fn(),
|
|
18
|
-
rootEdgeComponent: jest.fn(),
|
|
19
|
-
}));
|
|
20
|
-
describe('Parabola', () => {
|
|
21
|
-
let fnBody;
|
|
22
|
-
let graphProps;
|
|
23
|
-
let root;
|
|
24
|
-
let edge;
|
|
25
|
-
let result;
|
|
26
|
-
beforeEach(() => {
|
|
27
|
-
require('../component');
|
|
28
|
-
fnBody = withRootEdge.mock.calls[0][0];
|
|
29
|
-
graphProps = getGraphProps();
|
|
30
|
-
root = xy(0, 0);
|
|
31
|
-
edge = xy(1, 1);
|
|
32
|
-
|
|
33
|
-
result = fnBody({ graphProps, root, edge });
|
|
34
|
-
});
|
|
35
|
-
it('fnBody is not null', () => {
|
|
36
|
-
expect(fnBody).toBeDefined();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('calls buildDataPoints', () => {
|
|
40
|
-
const { domain, range } = graphProps;
|
|
41
|
-
expect(buildDataPoints).toHaveBeenCalledWith({ ...domain, step: 0.25 }, range, root, edge, expect.anything());
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('calls sinY', () => {
|
|
45
|
-
expect(sinY).toHaveBeenCalledWith(1, 4, expect.anything());
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('returns dataPoints', () => {
|
|
49
|
-
expect(result).toEqual({ root, edge, dataPoints: [] });
|
|
50
|
-
});
|
|
51
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { render } from '@pie-lib/test-utils';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Line } from '../component';
|
|
4
|
-
import { graphProps as getGraphProps } from '../../../__tests__/utils';
|
|
5
|
-
import { utils } from '@pie-lib/plot';
|
|
6
|
-
|
|
7
|
-
describe('Line', () => {
|
|
8
|
-
const renderComponent = (extras) => {
|
|
9
|
-
const defaults = {
|
|
10
|
-
classes: {},
|
|
11
|
-
className: 'className',
|
|
12
|
-
graphProps: getGraphProps(),
|
|
13
|
-
from: utils.xy(0, 0),
|
|
14
|
-
to: utils.xy(1, 1),
|
|
15
|
-
};
|
|
16
|
-
const props = { ...defaults, ...extras };
|
|
17
|
-
return render(<Line {...props} />);
|
|
18
|
-
};
|
|
19
|
-
describe('rendering', () => {
|
|
20
|
-
it('renders without crashing', () => {
|
|
21
|
-
const { container } = renderComponent();
|
|
22
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
});
|