diff --git a/test/ecdsa.js b/test/ecdsa.js index f6e1410..cbae3d6 100644 --- a/test/ecdsa.js +++ b/test/ecdsa.js @@ -50,14 +50,14 @@ describe('ecdsa', function () { .onCall(2).returns(new BigInteger('42')) // valid, but 'bad' signature .onCall(3).returns(new BigInteger('53')) // valid, good signature - var checkSig = this.mock() - checkSig.exactly(2) - checkSig.onCall(0).returns(false) // bad signature - checkSig.onCall(1).returns(true) // good signature + var mockCheckSig = this.mock() + mockCheckSig.exactly(2) + mockCheckSig.onCall(0).returns(false) // bad signature + mockCheckSig.onCall(1).returns(true) // good signature var x = new BigInteger('1').toBuffer(32) var h1 = new Buffer(32) - var k = ecdsa.deterministicGenerateK(h1, x, checkSig) + var k = ecdsa.deterministicGenerateK(h1, x, mockCheckSig) assert.strictEqual(k.toString(), '53') })) diff --git a/test/hdnode.js b/test/hdnode.js index b48b9e5..d12fa42 100644 --- a/test/hdnode.js +++ b/test/hdnode.js @@ -298,7 +298,7 @@ describe('HDNode', function () { }) // FIXME: test data is only testing Private -> private for now - f.children.forEach(function (c, i) { + f.children.forEach(function (c) { if (c.m === undefined) return it(c.path + ' from ' + f.master.fingerprint, function () { diff --git a/test/integration/_blockchain.js b/test/integration/_blockchain.js index 3a93a44..e3fdbb1 100644 --- a/test/integration/_blockchain.js +++ b/test/integration/_blockchain.js @@ -25,7 +25,7 @@ function fundAddress (unspents, outputs, callback) { txb.addOutput(x.address || kpAddress, x.value) }) - result.inputs.forEach(function (x, i) { + result.inputs.forEach(function (_, i) { txb.sign(i, keyPair) }) @@ -37,7 +37,7 @@ function fundAddress (unspents, outputs, callback) { // FIXME: @blocktrail can be very slow, give it time setTimeout(() => { - callback(null, outputs.map(function (x, i) { + callback(null, outputs.map(function (_, i) { return { txId: txId, vout: i } })) }, 3000) diff --git a/test/integration/multisig.js b/test/integration/multisig.js index 1d4c06f..4b8eb2e 100644 --- a/test/integration/multisig.js +++ b/test/integration/multisig.js @@ -62,8 +62,8 @@ describe('bitcoinjs-lib (multisig)', function () { // check that the above transaction included the intended address blockchain.t.addresses.unspents(blockchain.t.RETURN, function (err, unspents) { if (err) return callback(err) - if (!unspents.some(function (unspent) { - return unspent.txId === txId && unspent.value === 1e4 + if (!unspents.some(function (x) { + return x.txId === txId && x.value === 1e4 })) return callback(new Error('Could not find unspent after broadcast')) callback() diff --git a/test/transaction_builder.js b/test/transaction_builder.js index 130a319..09400cd 100644 --- a/test/transaction_builder.js +++ b/test/transaction_builder.js @@ -101,9 +101,9 @@ describe('TransactionBuilder', function () { var tx = new Transaction() f.inputs.forEach(function (input) { - var txHash = new Buffer(input.txId, 'hex').reverse() + var txHash2 = new Buffer(input.txId, 'hex').reverse() - tx.addInput(txHash, input.vout, undefined, bscript.fromASM(input.scriptSig)) + tx.addInput(txHash2, input.vout, undefined, bscript.fromASM(input.scriptSig)) }) f.outputs.forEach(function (output) { @@ -281,7 +281,7 @@ describe('TransactionBuilder', function () { f.inputs.forEach(function (input, index) { input.signs.forEach(function (sign) { var keyPairNetwork = NETWORKS[sign.network || f.network] - var keyPair = ECPair.fromWIF(sign.keyPair, keyPairNetwork) + var keyPair2 = ECPair.fromWIF(sign.keyPair, keyPairNetwork) var redeemScript if (sign.redeemScript) { @@ -289,10 +289,10 @@ describe('TransactionBuilder', function () { } if (!sign.throws) { - txb.sign(index, keyPair, redeemScript, sign.hashType, sign.value) + txb.sign(index, keyPair2, redeemScript, sign.hashType, sign.value) } else { assert.throws(function () { - txb.sign(index, keyPair, redeemScript, sign.hashType, sign.value) + txb.sign(index, keyPair2, redeemScript, sign.hashType, sign.value) }, new RegExp(f.exception)) } }) @@ -386,8 +386,8 @@ describe('TransactionBuilder', function () { txb = TransactionBuilder.fromTransaction(tx, network) } - var keyPair = ECPair.fromWIF(sign.keyPair, network) - txb.sign(i, keyPair, redeemScript, sign.hashType) + var keyPair2 = ECPair.fromWIF(sign.keyPair, network) + txb.sign(i, keyPair2, redeemScript, sign.hashType) // update the tx tx = txb.buildIncomplete() @@ -417,8 +417,8 @@ describe('TransactionBuilder', function () { // now import the Transaction var txb = TransactionBuilder.fromTransaction(tx, NETWORKS.testnet) - var keyPair = ECPair.fromWIF('91avARGdfge8E4tZfYLoxeJ5sGBdNJQH4kvjJoQFacbgx3cTMqe', network) - txb.sign(0, keyPair, redeemScript) + var keyPair2 = ECPair.fromWIF('91avARGdfge8E4tZfYLoxeJ5sGBdNJQH4kvjJoQFacbgx3cTMqe', network) + txb.sign(0, keyPair2, redeemScript) var tx2 = txb.build() assert.equal(tx2.getId(), 'eab59618a564e361adef6d918bd792903c3d41bcf1220137364fb847880467f9')