Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
Improve test coverage of signMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed Nov 24, 2017
1 parent b9a4208 commit 1a7c2e8
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/components/signMessage/signMessage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ ${signature}
expect(successToastSpy).to.have.been.calledWith({ label: 'Result copied to clipboard' });
});

it('allows to sign multiple messages, shows success toast each time', () => {
copyMock.returns(true);
wrapper.find('.message textarea').simulate('change', { target: { value: message } });
wrapper.find('#signMessageForm').simulate('submit');
expect(wrapper.find('.result Input').text()).to.equal(result);
expect(successToastSpy).to.have.been.calledWith({ label: 'Result copied to clipboard' });

copyMock.reset();
copyMock.returns(true);
wrapper.find('.message textarea').simulate('change', { target: { value: 'Second message' } });
wrapper.find('#signMessageForm').simulate('submit');
expect(successToastSpy).to.have.been.calledWith({ label: 'Result copied to clipboard' });
});

it('allows to sign a message with a locked account', () => {
copyMock.returns(true);

Expand Down Expand Up @@ -95,7 +109,7 @@ ${signature}
it('does not show success toast if copy-to-clipboard failed', () => {
copyMock.returns(false);
wrapper.find('.message textarea').simulate('change', { target: { value: message } });
wrapper.find('.primary-button').simulate('click');
wrapper.find('#signMessageForm').simulate('submit');
expect(successToastSpy).to.have.not.been.calledWith();
});
});

0 comments on commit 1a7c2e8

Please sign in to comment.