From 20a17cc915df88ad1f097965a963e1be83a05080 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Tue, 21 Jul 2015 11:03:40 +1000 Subject: [PATCH] tests: invert core test to use toBase58Check instead --- test/bitcoin.core.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test/bitcoin.core.js b/test/bitcoin.core.js index 5a20b18..613fc99 100644 --- a/test/bitcoin.core.js +++ b/test/bitcoin.core.js @@ -47,15 +47,15 @@ describe('Bitcoin-core', function () { }) // base58_keys_valid - describe('Address.fromBase58Check', function () { + describe('Address.toBase58Check', function () { var typeMap = { 'pubkey': 'pubKeyHash', 'script': 'scriptHash' } base58_keys_valid.forEach(function (f) { - var string = f[0] - var hex = f[1] + var expected = f[0] + var hash = new Buffer(f[1], 'hex') var params = f[2] var network = networks.bitcoin @@ -64,11 +64,10 @@ describe('Bitcoin-core', function () { network = networks.testnet } - it('can import ' + string, function () { - var decode = Address.fromBase58Check(string) + var version = network[typeMap[params.addrType]] - assert.strictEqual(decode.hash.toString('hex'), hex) - assert.strictEqual(decode.version, network[typeMap[params.addrType]]) + it('can export ' + expected, function () { + assert.strictEqual(Address.toBase58Check(hash, version), expected) }) }) })