add tests for preservation of compressed in privkey2pubkey

This commit is contained in:
Ryan X. Charles 2014-08-22 18:00:55 -07:00
parent 7c945cdc01
commit a80d512570
1 changed files with 18 additions and 0 deletions

View File

@ -99,6 +99,24 @@ describe('Key', function() {
key.pubkey.toString().should.equal(pubhex);
});
it('should convert this known Privkey to known Pubkey and preserve compressed=true', function() {
var privhex = '906977a061af29276e40bf377042ffbde414e496ae2260bbf1fa9d085637bfff';
var key = new Key();
key.privkey = new Privkey(bn(new Buffer(privhex, 'hex')));
key.privkey.compressed = true;
key.privkey2pubkey();
key.pubkey.compressed.should.equal(true);
});
it('should convert this known Privkey to known Pubkey and preserve compressed=true', function() {
var privhex = '906977a061af29276e40bf377042ffbde414e496ae2260bbf1fa9d085637bfff';
var key = new Key();
key.privkey = new Privkey(bn(new Buffer(privhex, 'hex')));
key.privkey.compressed = false;
key.privkey2pubkey();
key.pubkey.compressed.should.equal(false);
});
});
describe("#toString()", function() {