Skip to content

Commit

Permalink
tests(line): add test for curve interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Benitte authored and Raphaël Benitte committed Aug 30, 2018
1 parent d29d21f commit 1dc93d6
Show file tree
Hide file tree
Showing 2 changed files with 5,334 additions and 0 deletions.
44 changes: 44 additions & 0 deletions packages/line/tests/Line.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,47 @@ it('should have left and bottom axis by default', () => {
expect(axes.at(0).prop('position')).toBe('bottom')
expect(axes.at(1).prop('position')).toBe('left')
})

describe('curve interpolation', () => {
const curveInterpolations = [
'basis',
'cardinal',
'catmullRom',
'linear',
'monotoneX',
'monotoneY',
'natural',
'step',
'stepAfter',
'stepBefore',
]
const data = [
{
id: 'default',
data: [{ x: 0, y: 3 }, { x: 1, y: 7 }, { x: 2, y: 11 }, { x: 3, y: 9 }, { x: 4, y: 8 }],
},
]
for (const curveInterpolation of curveInterpolations) {
it(`should support ${curveInterpolation} curve interpolation`, () => {
const component = renderer.create(
<Line
width={500}
height={300}
data={data}
curve={curveInterpolation}
axisLeft={undefined}
axisBottom={undefined}
isInteractive={false}
enableStackTooltip={false}
animate={false}
enableDots={false}
enableGridX={false}
enableGridY={false}
/>
)

const tree = component.toJSON()
expect(tree).toMatchSnapshot()
})
}
})
Loading

0 comments on commit 1dc93d6

Please sign in to comment.