Skip to content

Instantly share code, notes, and snippets.

@NiGhTTraX
Last active February 12, 2017 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NiGhTTraX/eb3db78793d4537fdd99f98be398a67d to your computer and use it in GitHub Desktop.
Save NiGhTTraX/eb3db78793d4537fdd99f98be398a67d to your computer and use it in GitHub Desktop.
it('should delete the todo when clicking the delete button', function() {
const Button = createSpy();
const onDeleteSpy = spy();
jest.mock('./button.jsx', () => Button);
const Todo = require('./todo.jsx');
render(<Todo name="buy milk" onDelete={onDeleteSpy} />);
Button.lastProps.onSubmit();
expect(onDeleteSpy).to.have.been.called;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment