Browse Source

tests: invert core test to use toBase58Check instead

hk-custom-address
Daniel Cousens 10 years ago
parent
commit
20a17cc915
  1. 13
      test/bitcoin.core.js

13
test/bitcoin.core.js

@ -47,15 +47,15 @@ describe('Bitcoin-core', function () {
}) })
// base58_keys_valid // base58_keys_valid
describe('Address.fromBase58Check', function () { describe('Address.toBase58Check', function () {
var typeMap = { var typeMap = {
'pubkey': 'pubKeyHash', 'pubkey': 'pubKeyHash',
'script': 'scriptHash' 'script': 'scriptHash'
} }
base58_keys_valid.forEach(function (f) { base58_keys_valid.forEach(function (f) {
var string = f[0] var expected = f[0]
var hex = f[1] var hash = new Buffer(f[1], 'hex')
var params = f[2] var params = f[2]
var network = networks.bitcoin var network = networks.bitcoin
@ -64,11 +64,10 @@ describe('Bitcoin-core', function () {
network = networks.testnet network = networks.testnet
} }
it('can import ' + string, function () { var version = network[typeMap[params.addrType]]
var decode = Address.fromBase58Check(string)
assert.strictEqual(decode.hash.toString('hex'), hex) it('can export ' + expected, function () {
assert.strictEqual(decode.version, network[typeMap[params.addrType]]) assert.strictEqual(Address.toBase58Check(hash, version), expected)
}) })
}) })
}) })

Loading…
Cancel
Save