From d632bbb4cd4cab991b26c6b77d46f68ae605f4af Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Thu, 5 Feb 2015 11:09:30 -0300 Subject: [PATCH] add Address parameter test --- test/message.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/message.js b/test/message.js index 6632bce..6a2f48c 100644 --- a/test/message.js +++ b/test/message.js @@ -5,6 +5,7 @@ var expect = chai.expect; var should = chai.should(); var bitcore = require('bitcore'); +var Address = bitcore.Address; var Signature = bitcore.crypto.Signature; var Message = require('../'); @@ -24,7 +25,7 @@ describe('Message', function() { var publicKey = privateKey.toPublicKey(); it('will error with incorrect message type', function() { - expect(function(){ + expect(function() { return new Message(new Date()); }).to.throw('First argument should be a string'); }); @@ -46,7 +47,7 @@ describe('Message', function() { }); it('sign will error with incorrect private key argument', function() { - expect(function(){ + expect(function() { var message3 = new Message(text); return message3.sign('not a private key'); }).to.throw('First argument should be an instance of PrivateKey'); @@ -65,14 +66,14 @@ describe('Message', function() { }); it('verify will error with incorrect public key argument', function() { - expect(function(){ + expect(function() { var message6 = new Message(text); return message6._verify('not a public key', signature); }).to.throw(TypeError); }); it('verify will error with incorrect signature argument', function() { - expect(function(){ + expect(function() { var message7 = new Message(text); return message7._verify(publicKey, 'not a signature'); }).to.throw(TypeError); @@ -146,5 +147,10 @@ describe('Message', function() { }); + it('accepts Address for verification', function() { + var verified = Message(text) + .verify(new Address(address), signatureString); + verified.should.equal(true); + }); });