Skip to content

Commit

Permalink
[shape] add tests BarStack, BarGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
hshoff committed May 22, 2017
1 parent 447f479 commit 98b61b2
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/vx-shape/test/BarGroup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,10 @@ describe('<BarGroup />', () => {
expect(console.error).toBeCalled()
expect(console.error.mock.calls[0][0]).toEqual("Warning: Failed prop type: The prop `data` is marked as required in `BarGroup`, but its value is `undefined`.\n in BarGroup")
})

test('it should set top & left props', () => {
const wrapper = shallow(<BarGroup className='test' data={[]} top={2} left={3} />)
expect(wrapper.prop('top')).toEqual(2)
expect(wrapper.prop('left')).toEqual(3)
})
})
51 changes: 51 additions & 0 deletions packages/vx-shape/test/BarStack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,55 @@ describe('<BarStack />', () => {
test('it should be defined', () => {
expect(BarStack).toBeDefined()
})

test('it should have className .vx-bar-stack', () => {
const wrapper = shallow(
<BarStack
data={[]}
top={2}
left={3}
x={d => d}
xScale={d => d}
yScale={d => d}
zScale={d => d}
keys={[]}
/>
)
expect(wrapper.prop('className')).toEqual('vx-bar-stack')
})

test('it should set className prop', () => {
const wrapper = shallow(
<BarStack
className='test'
data={[]}
top={2}
left={3}
x={d => d}
xScale={d => d}
yScale={d => d}
zScale={d => d}
keys={[]}
/>
)
expect(wrapper.prop('className')).toEqual('vx-bar-stack test')
})

test('it should set top & left props', () => {
const wrapper = shallow(
<BarStack
className='test'
data={[]}
top={2}
left={3}
x={d => d}
xScale={d => d}
yScale={d => d}
zScale={d => d}
keys={[]}
/>
)
expect(wrapper.prop('top')).toEqual(2)
expect(wrapper.prop('left')).toEqual(3)
})
})

0 comments on commit 98b61b2

Please sign in to comment.