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

Commit

Permalink
Use expect(...).to.throw in verifyMessageWithPublicKey test
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed May 9, 2017
1 parent e19dd9d commit 963c408
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions test/transactions/crypto/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,16 @@ describe('crypto/index.js', function () {

it('should detect invalid publicKeys', function () {
var invalidPublicKey = keypair.publicKey + 'ERROR';
try {
newcrypto.verifyMessageWithPublicKey(signedMessage, invalidPublicKey);
} catch (error) {
(error.message).should.be.equal('Invalid publicKey, expected 32-byte publicKey');
}
expect(function () {
newcrypto.verifyMessageWithPublicKey(signedMessage, invalidPublicKey);
}).to.throw(Error, 'Invalid publicKey, expected 32-byte publicKey');
});

it('should detect not verifiable signature', function () {
var signedMessage = newcrypto.signMessageWithSecret(message, secret) + 'ERROR';
try {
expect(function () {
newcrypto.verifyMessageWithPublicKey(signedMessage, publicKey);
} catch (error) {
(error.message).should.be.equal('Invalid signature publicKey combination, cannot verify message');
}
}).to.throw(Error, 'Invalid signature publicKey combination, cannot verify message');
});
});

Expand Down

0 comments on commit 963c408

Please sign in to comment.