Browse Source

Tests: Check that an Address is using the defaultNetwork

patch-2
Braydon Fuller 10 years ago
parent
commit
2cbcf7da1c
  1. 13
      test/address.js

13
test/address.js

@ -6,6 +6,7 @@ var bitcore = require('..');
var PublicKey = bitcore.PublicKey;
var Address = bitcore.Address;
var Script = bitcore.Script;
var networks = bitcore.Networks;
describe('Address', function() {
@ -260,6 +261,18 @@ describe('Address', function() {
var c = new Address(hash).toString().should.equal(str);
});
it('should make an address using the default network', function() {
var hash = pubkeyhash; //use the same hash
var a = Address.fromPublicKeyHash(hash);
a.network.should.equal('livenet');
// change the default
networks.defaultNetwork = networks.testnet;
var b = Address.fromPublicKeyHash(hash);
b.network.should.equal('testnet');
// restore the default
networks.defaultNetwork = networks.livenet;
});
it('should throw an error for invalid length hashBuffer', function() {
(function() {
var a = Address.fromPublicKeyHash(buf);

Loading…
Cancel
Save