Skip to content

Commit 5b0ccb6

Browse files
authored
Merge pull request bitcoinjs#1007 from hackerrdave/update-sinon
upgrade test dependencies
2 parents fdcd7aa + 504b6c2 commit 5b0ccb6

File tree

5 files changed

+25
-18
lines changed

5 files changed

+25
-18
lines changed

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@
5252
"bs58": "^4.0.0",
5353
"dhttp": "^2.4.2",
5454
"minimaldata": "^1.0.2",
55-
"mocha": "^3.1.0",
56-
"nyc": "^10.2.0",
55+
"mocha": "^5.0.1",
56+
"nyc": "^11.4.1",
5757
"proxyquire": "^1.4.0",
58-
"sinon": "^1.12.2",
58+
"sinon": "^4.3.0",
59+
"sinon-test": "^2.1.3",
5960
"standard": "^9.0.2"
6061
},
6162
"license": "MIT"

test/address.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('address', function () {
6666

6767
assert.throws(function () {
6868
baddress.fromOutputScript(script)
69-
}, new RegExp(f.script + ' ' + f.exception))
69+
}, new RegExp(f.exception))
7070
})
7171
})
7272
})

test/ecdsa.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ var assert = require('assert')
44
var bcrypto = require('../src/crypto')
55
var ecdsa = require('../src/ecdsa')
66
var sinon = require('sinon')
7+
var sinonTest = require('sinon-test')
8+
var setupTest = sinonTest(sinon)
79

810
var BigInteger = require('bigi')
911
var ECSignature = require('../src/ecsignature')
@@ -28,7 +30,7 @@ describe('ecdsa', function () {
2830
})
2931
})
3032

31-
it('loops until an appropriate k value is found', sinon.test(function () {
33+
it('loops until an appropriate k value is found', setupTest(function () {
3234
this.mock(BigInteger).expects('fromBuffer')
3335
.exactly(3)
3436
.onCall(0).returns(new BigInteger('0')) // < 1
@@ -42,7 +44,7 @@ describe('ecdsa', function () {
4244
assert.strictEqual(k.toString(), '42')
4345
}))
4446

45-
it('loops until a suitable signature is found', sinon.test(function () {
47+
it('loops until a suitable signature is found', setupTest(function () {
4648
this.mock(BigInteger).expects('fromBuffer')
4749
.exactly(4)
4850
.onCall(0).returns(new BigInteger('0')) // < 1

test/ecpair.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ var ecdsa = require('../src/ecdsa')
66
var ecurve = require('ecurve')
77
var proxyquire = require('proxyquire')
88
var sinon = require('sinon')
9+
var sinonTest = require('sinon-test')
10+
var setupTest = sinonTest(sinon)
911

1012
var BigInteger = require('bigi')
1113
var ECPair = require('../src/ecpair')
@@ -74,7 +76,7 @@ describe('ECPair', function () {
7476
keyPair = new ECPair(BigInteger.ONE)
7577
})
7678

77-
it('wraps Q.getEncoded', sinon.test(function () {
79+
it('wraps Q.getEncoded', setupTest(function () {
7880
this.mock(keyPair.Q).expects('getEncoded')
7981
.once().withArgs(keyPair.compressed)
8082

@@ -165,7 +167,7 @@ describe('ECPair', function () {
165167
assert.strictEqual(keyPair.network, NETWORKS.testnet)
166168
})
167169

168-
it('loops until d is within interval [1, n - 1] : 1', sinon.test(function () {
170+
it('loops until d is within interval [1, n - 1] : 1', setupTest(function () {
169171
var rng = this.mock()
170172
rng.exactly(2)
171173
rng.onCall(0).returns(BigInteger.ZERO.toBuffer(32)) // invalid length
@@ -174,7 +176,7 @@ describe('ECPair', function () {
174176
ECPair.makeRandom({ rng: rng })
175177
}))
176178

177-
it('loops until d is within interval [1, n - 1] : n - 1', sinon.test(function () {
179+
it('loops until d is within interval [1, n - 1] : n - 1', setupTest(function () {
178180
var rng = this.mock()
179181
rng.exactly(3)
180182
rng.onCall(0).returns(BigInteger.ZERO.toBuffer(32)) // < 1
@@ -215,7 +217,7 @@ describe('ECPair', function () {
215217
})
216218

217219
describe('signing', function () {
218-
it('wraps ecdsa.sign', sinon.test(function () {
220+
it('wraps ecdsa.sign', setupTest(function () {
219221
this.mock(ecdsa).expects('sign')
220222
.once().withArgs(hash, keyPair.d)
221223

@@ -238,7 +240,7 @@ describe('ECPair', function () {
238240
signature = keyPair.sign(hash)
239241
})
240242

241-
it('wraps ecdsa.verify', sinon.test(function () {
243+
it('wraps ecdsa.verify', setupTest(function () {
242244
this.mock(ecdsa).expects('verify')
243245
.once().withArgs(hash, signature, keyPair.Q)
244246

test/hdnode.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
var assert = require('assert')
55
var ecdsa = require('../src/ecdsa')
66
var sinon = require('sinon')
7+
var sinonTest = require('sinon-test')
8+
var setupTest = sinonTest(sinon)
79

810
var BigInteger = require('bigi')
911
var ECPair = require('../src/ecpair')
@@ -79,7 +81,7 @@ describe('HDNode', function () {
7981
})
8082
})
8183

82-
it('throws if IL is not within interval [1, n - 1] | IL === 0', sinon.test(function () {
84+
it('throws if IL is not within interval [1, n - 1] | IL === 0', setupTest(function () {
8385
this.mock(BigInteger).expects('fromBuffer')
8486
.once().returns(BigInteger.ZERO)
8587

@@ -88,7 +90,7 @@ describe('HDNode', function () {
8890
}, /Private key must be greater than 0/)
8991
}))
9092

91-
it('throws if IL is not within interval [1, n - 1] | IL === n', sinon.test(function () {
93+
it('throws if IL is not within interval [1, n - 1] | IL === n', setupTest(function () {
9294
this.mock(BigInteger).expects('fromBuffer')
9395
.once().returns(curve.n)
9496

@@ -122,7 +124,7 @@ describe('HDNode', function () {
122124
})
123125

124126
describe('getAddress', function () {
125-
it('wraps keyPair.getAddress', sinon.test(function () {
127+
it('wraps keyPair.getAddress', setupTest(function () {
126128
this.mock(keyPair).expects('getAddress')
127129
.once().withArgs().returns('foobar')
128130

@@ -131,7 +133,7 @@ describe('HDNode', function () {
131133
})
132134

133135
describe('getNetwork', function () {
134-
it('wraps keyPair.getNetwork', sinon.test(function () {
136+
it('wraps keyPair.getNetwork', setupTest(function () {
135137
this.mock(keyPair).expects('getNetwork')
136138
.once().withArgs().returns('network')
137139

@@ -140,7 +142,7 @@ describe('HDNode', function () {
140142
})
141143

142144
describe('getPublicKeyBuffer', function () {
143-
it('wraps keyPair.getPublicKeyBuffer', sinon.test(function () {
145+
it('wraps keyPair.getPublicKeyBuffer', setupTest(function () {
144146
this.mock(keyPair).expects('getPublicKeyBuffer')
145147
.once().withArgs().returns('pubKeyBuffer')
146148

@@ -149,7 +151,7 @@ describe('HDNode', function () {
149151
})
150152

151153
describe('sign', function () {
152-
it('wraps keyPair.sign', sinon.test(function () {
154+
it('wraps keyPair.sign', setupTest(function () {
153155
this.mock(keyPair).expects('sign')
154156
.once().withArgs(hash).returns('signed')
155157

@@ -164,7 +166,7 @@ describe('HDNode', function () {
164166
signature = hd.sign(hash)
165167
})
166168

167-
it('wraps keyPair.verify', sinon.test(function () {
169+
it('wraps keyPair.verify', setupTest(function () {
168170
this.mock(keyPair).expects('verify')
169171
.once().withArgs(hash, signature).returns('verified')
170172

0 commit comments

Comments
 (0)