Tweaks to item test

This commit is contained in:
Tom Southall
2022-02-17 15:22:50 +00:00
parent 6954154ee0
commit 5ee40eab38

View File

@@ -21,25 +21,26 @@ const item = {
}
}
const index = 0
const component = renderer.create(
<StateContextProvider styles={customStyles} text={'Chi'} items={[item]}>
<Item
index={0}
key={'item0'}
index={index}
key={`item${index}`}
item={item}
/>
</StateContextProvider>
)
let tree = component.toJSON()
describe('Item', () => {
test('Component renders correctly', () => {
expect(tree).toMatchSnapshot()
})
test('Link changes the class when hovered', () => {
// Manually trigger onMouseEnter callback and rerender
// Manually trigger onMouseEnter and rerender
tree.props.onMouseEnter()
tree = component.toJSON()