Browse Source

Merge pull request #763 from braydonf/bug/public-key-inspect

PublicKey: Fix formatting issue for inspect
patch-2
Manuel Aráoz 10 years ago
parent
commit
b2771e1c68
  1. 2
      lib/publickey.js
  2. 6
      test/publickey.js

2
lib/publickey.js

@ -403,7 +403,7 @@ PublicKey.prototype.toString = function() {
PublicKey.prototype.inspect = function() {
return '<PublicKey: ' + this.toString() +
(this.compressed ? '' : ', uncompressed') +
(this.network ? this.network.name : '') + '>';
(this.network ? ', network: ' + this.network.name : '') + '>';
};

6
test/publickey.js

@ -300,6 +300,12 @@ describe('PublicKey', function() {
pubkey.inspect().should.equal('<PublicKey: 031ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a>');
});
it('should output known compressed pubkey with network for console', function() {
var privkey = PrivateKey.fromWIF('L3T1s1TYP9oyhHpXgkyLoJFGniEgkv2Jhi138d7R2yJ9F4QdDU2m');
var pubkey = new PublicKey(privkey);
pubkey.inspect().should.equal('<PublicKey: 03c87bd0e162f26969da8509cafcb7b8c8d202af30b928c582e263dd13ee9a9781, network: livenet>');
});
});
describe('#validate', function() {

Loading…
Cancel
Save