tests: bitcoin/core check WIF exports correctly

This commit is contained in:
Daniel Cousens 2015-02-23 10:26:01 +11:00
parent ff3b1bd395
commit 376c6533f1

View file

@ -96,17 +96,19 @@ describe('Bitcoin-core', function() {
var string = f[0] var string = f[0]
var hex = f[1] var hex = f[1]
var params = f[2] var params = f[2]
var network = networks.bitcoin var network = params.isTestnet ? networks.testnet : networks.bitcoin
if (!params.isPrivkey) return if (!params.isPrivkey) return
if (params.isTestnet) network = networks.testnet var privKey = ECKey.fromWIF(string)
it('imports ' + string + ' correctly', function() { it('imports ' + string + ' correctly', function() {
var privKey = ECKey.fromWIF(string)
assert.equal(privKey.d.toHex(), hex) assert.equal(privKey.d.toHex(), hex)
assert.equal(privKey.pub.compressed, params.isCompressed) assert.equal(privKey.pub.compressed, params.isCompressed)
}) })
it('exports ' + hex + ' to ' + string, function() {
assert.equal(privKey.toWIF(network), string)
})
}) })
}) })