Skip to content

Instantly share code, notes, and snippets.

@lai32290
Created September 23, 2020 21:30
Show Gist options
  • Save lai32290/94fc389676b85df88b748570a9cf25f9 to your computer and use it in GitHub Desktop.
Save lai32290/94fc389676b85df88b748570a9cf25f9 to your computer and use it in GitHub Desktop.
test('setOpenIndex sets the open index state properly', () => {
const wrapper = mount(<Accordion items={[]} />)
- expect(wrapper.state('openIndex')).toEqual(0)
+ expect(wrapper.state('openIndexes')).toEqual([0])
wrapper.instance().setOpenIndex(1)
- expect(wrapper.state('openIndex')).toEqual(1)
+ expect(wrapper.state('openIndexes')).toEqual([1])
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment