add hex generation of addresses test

This commit is contained in:
Manuel Araoz 2014-03-19 17:57:28 -03:00
parent 53eb98babc
commit f2be0f386c
1 changed files with 7 additions and 1 deletions

View File

@ -108,6 +108,7 @@ describe('Miscelaneous stuff', function() {
} else {
describe('base58 address valid ' + b58, function() {
var a;
var shouldBeScript = meta.addrType === 'script';
before(function() {
a = new Address(b58);
});
@ -115,11 +116,16 @@ describe('Miscelaneous stuff', function() {
a.isValid().should.equal(true);
});
it('should be of correct type', function() {
a.isScript().should.equal(meta.addrType === 'script');
a.isScript().should.equal(shouldBeScript);
});
it('should get correct network', function() {
a.network().should.equal(network);
});
it('should generate correctly from hex', function() {
var version = shouldBeScript? network.addressScript: network.addressPubkey;
var b = new Address(version, new Buffer(hexPayload, 'hex'));
b.toString().should.equal(b58);
});
});
}
});