Browse Source

fix spacing

hk-custom-address
Kyle Drake 11 years ago
parent
commit
a6706ea8be
No known key found for this signature in database GPG Key ID: 8BE721072E1864BE
  1. 76
      test/address.js

76
test/address.js

@ -18,48 +18,48 @@ describe('Address', function() {
}) })
describe('parsing', function() { describe('parsing', function() {
it('works with Address object', function() { it('works with Address object', function() {
var addr = new Address(new Address('mwrB4fgT1KSBCqELaWv7o7tsExuQzW3NY3', network.testnet.addressVersion)) var addr = new Address(new Address('mwrB4fgT1KSBCqELaWv7o7tsExuQzW3NY3', network.testnet.addressVersion))
assert.equal(addr.toString(), 'mwrB4fgT1KSBCqELaWv7o7tsExuQzW3NY3') assert.equal(addr.toString(), 'mwrB4fgT1KSBCqELaWv7o7tsExuQzW3NY3')
assert.equal(addr.version, network.testnet.addressVersion) assert.equal(addr.version, network.testnet.addressVersion)
}) })
it('works with hex', function() { it('works with hex', function() {
var addr = new Address('13483382d3c3d43fc9d7b52e652b6bbb70e8b667') var addr = new Address('13483382d3c3d43fc9d7b52e652b6bbb70e8b667')
assert.equal(addr.toString(), '12kxLGqrnnchwN9bHHNV2fWDtJGwxKTcJS') assert.equal(addr.toString(), '12kxLGqrnnchwN9bHHNV2fWDtJGwxKTcJS')
}) })
it('throws error for invalid or unrecognized input', function() { it('throws error for invalid or unrecognized input', function() {
assert.throws(function() { assert.throws(function() {
new Address('beepboopbeepboopbeepboopbeepboopbeepboopbeep') new Address('beepboopbeepboopbeepboopbeepboopbeepboopbeep')
}, Error) }, Error)
}) })
it('works for byte input', function() { it('works for byte input', function() {
var hash = base58.checkDecode('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa') var hash = base58.checkDecode('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa')
var addr = new Address(hash) var addr = new Address(hash)
assert.equal(addr.hash, hash) assert.equal(addr.hash, hash)
assert.equal(network.mainnet.addressVersion, hash.version) assert.equal(network.mainnet.addressVersion, hash.version)
var hash = base58.checkDecode('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef') var hash = base58.checkDecode('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef')
var addr = new Address(hash) var addr = new Address(hash)
assert.equal(addr.hash, hash) assert.equal(addr.hash, hash)
assert.equal(network.testnet.addressVersion, hash.version) assert.equal(network.testnet.addressVersion, hash.version)
}) })
it('fails for bad input', function() { it('fails for bad input', function() {
assert.throws(function() { assert.throws(function() {
new Address('foo') new Address('foo')
}, Error) }, Error)
}) })
}) })
describe('getVersion', function() { describe('getVersion', function() {
it('returns the proper address version', function() { it('returns the proper address version', function() {
assert.equal(Address.getVersion('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa'), network.mainnet.addressVersion) assert.equal(Address.getVersion('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa'), network.mainnet.addressVersion)
assert.equal(Address.getVersion('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef'), network.testnet.addressVersion) assert.equal(Address.getVersion('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef'), network.testnet.addressVersion)
}) })
}) })
describe('toString', function() { describe('toString', function() {

Loading…
Cancel
Save