From b55874718a5ead88778d844339bb60ccbc9253a8 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Thu, 19 Mar 2015 11:15:51 +1100 Subject: [PATCH] integration: use an rng for the example over mocking --- test/integration/basic.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/test/integration/basic.js b/test/integration/basic.js index 069a535..7a76889 100644 --- a/test/integration/basic.js +++ b/test/integration/basic.js @@ -3,21 +3,18 @@ var assert = require('assert') var bigi = require('bigi') var bitcoin = require('../../') -var crypto = require('crypto') -var sinon = require('sinon') describe('bitcoinjs-lib (basic)', function () { - it('can generate a random bitcoin address', sinon.test(function () { + it('can generate a random bitcoin address', function () { // for testing only - this.mock(crypto).expects('randomBytes') - .onCall(0).returns(new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz')) + function rng () { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz') } - // generate random key - var key = bitcoin.ECKey.makeRandom() + // generate random key (custom rng for testing only) + var key = bitcoin.ECKey.makeRandom(undefined, rng) var address = key.pub.getAddress().toString() assert.equal(address, '1F5VhMHukdnUES9kfXqzPzMeF1GPHKiF64') - })) + }) it('can generate an address from a SHA256 hash', function () { var hash = bitcoin.crypto.sha256('correct horse battery staple')