Skip to content

Instantly share code, notes, and snippets.

@michelts
Created March 22, 2019 16:13
Show Gist options
  • Save michelts/17566bd01242b2fafcd2d53d4728677d to your computer and use it in GitHub Desktop.
Save michelts/17566bd01242b2fafcd2d53d4728677d to your computer and use it in GitHub Desktop.
it('should ask a new Card when click the button', () => {
const cards = [];
const setCards = jest.fn();
useGlobal.mockReturnValueOnce([cards, setCards]);
const wrapper = shallow(<Cards />);
wrapper.find('button').simulate('click');
expect(getRandomCard).toHaveBeenCalledWith(cards);
expect(setCards).toHaveBeenCalledWith(getRandomCard.mock.results[0].value);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment