Skip to content

Instantly share code, notes, and snippets.

@carlosble
Created April 5, 2017 19:22
Show Gist options
  • Save carlosble/349b3004668a7f724f1cf46b8d508dff to your computer and use it in GitHub Desktop.
Save carlosble/349b3004668a7f724f1cf46b8d508dff to your computer and use it in GitHub Desktop.
Spying on the action to test component in isolation
it('deletes email when button is clicked', () => {
let address = addressBuilder().withEmails([email0, email1]).build();
form.setProps({address: address});
actions.updateEmails = jest.fn((value) => {
expect(value).toEqual(email1);
});
const buttons = form.find(inputByClass(deleteEmailCss));
simulateClick(buttons.first());
expect(actions.updateEmails).toHaveBeenCalled();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment