Skip to content

Commit ec9cea0

Browse files
committed
tests: use strictEqual always
1 parent ab66c98 commit ec9cea0

19 files changed

+186
-186
lines changed

test/address.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ describe('Address', function () {
1515
var hash = new Buffer(f.hash, 'hex')
1616
var addr = new Address(hash, f.version)
1717

18-
assert.equal(addr.version, f.version)
19-
assert.equal(addr.hash.toString('hex'), f.hash)
18+
assert.strictEqual(addr.version, f.version)
19+
assert.strictEqual(addr.hash.toString('hex'), f.hash)
2020
})
2121
})
2222
})
@@ -26,8 +26,8 @@ describe('Address', function () {
2626
it('imports ' + f.script + ' (' + f.network + ') correctly', function () {
2727
var addr = Address.fromBase58Check(f.base58check)
2828

29-
assert.equal(addr.version, f.version)
30-
assert.equal(addr.hash.toString('hex'), f.hash)
29+
assert.strictEqual(addr.version, f.version)
30+
assert.strictEqual(addr.hash.toString('hex'), f.hash)
3131
})
3232
})
3333

@@ -46,8 +46,8 @@ describe('Address', function () {
4646
var script = Script.fromASM(f.script)
4747
var addr = Address.fromOutputScript(script, networks[f.network])
4848

49-
assert.equal(addr.version, f.version)
50-
assert.equal(addr.hash.toString('hex'), f.hash)
49+
assert.strictEqual(addr.version, f.version)
50+
assert.strictEqual(addr.hash.toString('hex'), f.hash)
5151
})
5252
})
5353

@@ -68,7 +68,7 @@ describe('Address', function () {
6868
var addr = Address.fromBase58Check(f.base58check)
6969
var result = addr.toBase58Check()
7070

71-
assert.equal(result, f.base58check)
71+
assert.strictEqual(result, f.base58check)
7272
})
7373
})
7474
})
@@ -79,7 +79,7 @@ describe('Address', function () {
7979
var addr = Address.fromBase58Check(f.base58check)
8080
var script = addr.toOutputScript()
8181

82-
assert.equal(script.toASM(), f.script)
82+
assert.strictEqual(script.toASM(), f.script)
8383
})
8484
})
8585

test/bitcoin.core.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ describe('Bitcoin-core', function () {
3434
var buffer = base58.decode(fb58)
3535
var actual = new Buffer(buffer).toString('hex')
3636

37-
assert.equal(actual, fhex)
37+
assert.strictEqual(actual, fhex)
3838
})
3939

4040
it('can encode ' + fhex, function () {
4141
var buffer = new Buffer(fhex, 'hex')
4242
var actual = base58.encode(buffer)
4343

44-
assert.equal(actual, fb58)
44+
assert.strictEqual(actual, fb58)
4545
})
4646
})
4747
})
@@ -66,8 +66,8 @@ describe('Bitcoin-core', function () {
6666
it('can import ' + string, function () {
6767
var address = Address.fromBase58Check(string)
6868

69-
assert.equal(address.hash.toString('hex'), hex)
70-
assert.equal(address.version, network[typeMap[params.addrType]])
69+
assert.strictEqual(address.hash.toString('hex'), hex)
70+
assert.strictEqual(address.version, network[typeMap[params.addrType]])
7171
})
7272
})
7373
})
@@ -105,12 +105,12 @@ describe('Bitcoin-core', function () {
105105
var keyPair = ECPair.fromWIF(string)
106106

107107
it('imports ' + string, function () {
108-
assert.equal(keyPair.d.toHex(), hex)
109-
assert.equal(keyPair.compressed, params.isCompressed)
108+
assert.strictEqual(keyPair.d.toHex(), hex)
109+
assert.strictEqual(keyPair.compressed, params.isCompressed)
110110
})
111111

112112
it('exports ' + hex + ' to ' + string, function () {
113-
assert.equal(keyPair.toWIF(), string)
113+
assert.strictEqual(keyPair.toWIF(), string)
114114
})
115115
})
116116
})
@@ -140,8 +140,8 @@ describe('Bitcoin-core', function () {
140140
it('fromHex can parse ' + f.id, function () {
141141
var block = Block.fromHex(f.hex)
142142

143-
assert.equal(block.getId(), f.id)
144-
assert.equal(block.transactions.length, f.transactions)
143+
assert.strictEqual(block.getId(), f.id)
144+
assert.strictEqual(block.transactions.length, f.transactions)
145145
})
146146
})
147147
})
@@ -170,7 +170,7 @@ describe('Bitcoin-core', function () {
170170
assert.deepEqual(txIn.hash, prevOutHash)
171171

172172
// we read UInt32, not Int32
173-
assert.equal(txIn.index & 0xffffffff, prevOutIndex)
173+
assert.strictEqual(txIn.index & 0xffffffff, prevOutIndex)
174174
})
175175
})
176176
})
@@ -200,10 +200,10 @@ describe('Bitcoin-core', function () {
200200

201201
it('should hash ' + txHex.slice(0, 40) + '... (' + hashTypeName + ')', function () {
202202
var transaction = Transaction.fromHex(txHex)
203-
assert.equal(transaction.toHex(), txHex)
203+
assert.strictEqual(transaction.toHex(), txHex)
204204

205205
var script = Script.fromHex(scriptHex)
206-
assert.equal(script.toHex(), scriptHex)
206+
assert.strictEqual(script.toHex(), scriptHex)
207207

208208
var hash = transaction.hashForSignature(inIndex, script, hashType)
209209
assert.deepEqual(hash, expectedHash)
@@ -218,7 +218,7 @@ describe('Bitcoin-core', function () {
218218
it('can parse ' + hex, function () {
219219
var parsed = ECSignature.parseScriptSignature(buffer)
220220
var actual = parsed.signature.toScriptSignature(parsed.hashType)
221-
assert.equal(actual.toString('hex'), hex)
221+
assert.strictEqual(actual.toString('hex'), hex)
222222
})
223223
})
224224

test/block.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ describe('Block', function () {
1212
it('imports the block: ' + f.description + ' correctly', function () {
1313
var block = Block.fromHex(f.hex)
1414

15-
assert.equal(block.version, f.version)
16-
assert.equal(block.prevHash.toString('hex'), f.prevHash)
17-
assert.equal(block.merkleRoot.toString('hex'), f.merkleRoot)
18-
assert.equal(block.timestamp, f.timestamp)
19-
assert.equal(block.bits, f.bits)
20-
assert.equal(block.nonce, f.nonce)
15+
assert.strictEqual(block.version, f.version)
16+
assert.strictEqual(block.prevHash.toString('hex'), f.prevHash)
17+
assert.strictEqual(block.merkleRoot.toString('hex'), f.merkleRoot)
18+
assert.strictEqual(block.timestamp, f.timestamp)
19+
assert.strictEqual(block.bits, f.bits)
20+
assert.strictEqual(block.nonce, f.nonce)
2121
})
2222
})
2323

@@ -39,7 +39,7 @@ describe('Block', function () {
3939
})
4040

4141
it('exports the block: ' + f.description + ' correctly', function () {
42-
assert.equal(block.toHex(), f.hex)
42+
assert.strictEqual(block.toHex(), f.hex)
4343
})
4444
})
4545
})
@@ -53,7 +53,7 @@ describe('Block', function () {
5353
})
5454

5555
it('calculates ' + f.hash + ' for the block: ' + f.description, function () {
56-
assert.equal(block.getHash().toString('hex'), f.hash)
56+
assert.strictEqual(block.getHash().toString('hex'), f.hash)
5757
})
5858
})
5959
})
@@ -67,7 +67,7 @@ describe('Block', function () {
6767
})
6868

6969
it('calculates ' + f.id + ' for the block: ' + f.description, function () {
70-
assert.equal(block.getId(), f.id)
70+
assert.strictEqual(block.getId(), f.id)
7171
})
7272
})
7373
})
@@ -83,7 +83,7 @@ describe('Block', function () {
8383
it('returns UTC date of ' + f.id, function () {
8484
var utcDate = block.getUTCDate().getTime()
8585

86-
assert.equal(utcDate, f.timestamp * 1e3)
86+
assert.strictEqual(utcDate, f.timestamp * 1e3)
8787
})
8888
})
8989
})

test/bufferutils.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('bufferutils', function () {
1313

1414
var size = bufferutils.pushDataSize(f.dec)
1515

16-
assert.equal(size, f.hexPD.length / 2)
16+
assert.strictEqual(size, f.hexPD.length / 2)
1717
})
1818
})
1919
})
@@ -27,9 +27,9 @@ describe('bufferutils', function () {
2727
var d = bufferutils.readPushDataInt(buffer, 0)
2828
var fopcode = parseInt(f.hexPD.substr(0, 2), 16)
2929

30-
assert.equal(d.opcode, fopcode)
31-
assert.equal(d.number, f.dec)
32-
assert.equal(d.size, buffer.length)
30+
assert.strictEqual(d.opcode, fopcode)
31+
assert.strictEqual(d.number, f.dec)
32+
assert.strictEqual(d.size, buffer.length)
3333
})
3434
})
3535

@@ -40,7 +40,7 @@ describe('bufferutils', function () {
4040
var buffer = new Buffer(f.hexPD, 'hex')
4141

4242
var n = bufferutils.readPushDataInt(buffer, 0)
43-
assert.equal(n, null)
43+
assert.strictEqual(n, null)
4444
})
4545
})
4646
})
@@ -51,7 +51,7 @@ describe('bufferutils', function () {
5151
var buffer = new Buffer(f.hex64, 'hex')
5252
var number = bufferutils.readUInt64LE(buffer, 0)
5353

54-
assert.equal(number, f.dec)
54+
assert.strictEqual(number, f.dec)
5555
})
5656
})
5757

@@ -72,8 +72,8 @@ describe('bufferutils', function () {
7272
var buffer = new Buffer(f.hexVI, 'hex')
7373
var d = bufferutils.readVarInt(buffer, 0)
7474

75-
assert.equal(d.number, f.dec)
76-
assert.equal(d.size, buffer.length)
75+
assert.strictEqual(d.number, f.dec)
76+
assert.strictEqual(d.size, buffer.length)
7777
})
7878
})
7979

@@ -106,7 +106,7 @@ describe('bufferutils', function () {
106106
it('encodes ' + f.dec + ' correctly', function () {
107107
var buffer = bufferutils.varIntBuffer(f.dec)
108108

109-
assert.equal(buffer.toString('hex'), f.hexVI)
109+
assert.strictEqual(buffer.toString('hex'), f.hexVI)
110110
})
111111
})
112112
})
@@ -116,7 +116,7 @@ describe('bufferutils', function () {
116116
it('determines the varIntSize of ' + f.dec + ' correctly', function () {
117117
var size = bufferutils.varIntSize(f.dec)
118118

119-
assert.equal(size, f.hexVI.length / 2)
119+
assert.strictEqual(size, f.hexVI.length / 2)
120120
})
121121
})
122122
})
@@ -130,7 +130,7 @@ describe('bufferutils', function () {
130130
buffer.fill(0)
131131

132132
var n = bufferutils.writePushDataInt(buffer, f.dec, 0)
133-
assert.equal(buffer.slice(0, n).toString('hex'), f.hexPD)
133+
assert.strictEqual(buffer.slice(0, n).toString('hex'), f.hexPD)
134134
})
135135
})
136136
})
@@ -142,7 +142,7 @@ describe('bufferutils', function () {
142142
buffer.fill(0)
143143

144144
bufferutils.writeUInt64LE(buffer, f.dec, 0)
145-
assert.equal(buffer.toString('hex'), f.hex64)
145+
assert.strictEqual(buffer.toString('hex'), f.hex64)
146146
})
147147
})
148148

@@ -165,7 +165,7 @@ describe('bufferutils', function () {
165165
buffer.fill(0)
166166

167167
var n = bufferutils.writeVarInt(buffer, f.dec, 0)
168-
assert.equal(buffer.slice(0, n).toString('hex'), f.hexVI)
168+
assert.strictEqual(buffer.slice(0, n).toString('hex'), f.hexVI)
169169
})
170170
})
171171

test/crypto.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('Crypto', function () {
1616
var data = new Buffer(f.hex, 'hex')
1717
var actual = fn(data).toString('hex')
1818

19-
assert.equal(actual, expected)
19+
assert.strictEqual(actual, expected)
2020
})
2121
})
2222
})

test/ecdsa.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('ecdsa', function () {
2727
var h1 = crypto.sha256(f.message)
2828

2929
var k = ecdsa.deterministicGenerateK(curve, h1, d, checkSig)
30-
assert.equal(k.toHex(), f.k)
30+
assert.strictEqual(k.toHex(), f.k)
3131
})
3232
})
3333

@@ -42,7 +42,7 @@ describe('ecdsa', function () {
4242
var h1 = new Buffer(32)
4343
var k = ecdsa.deterministicGenerateK(curve, h1, d, checkSig)
4444

45-
assert.equal(k.toString(), '42')
45+
assert.strictEqual(k.toString(), '42')
4646
}))
4747

4848
it('loops until a suitable signature is found', sinon.test(function () {
@@ -62,7 +62,7 @@ describe('ecdsa', function () {
6262
var h1 = new Buffer(32)
6363
var k = ecdsa.deterministicGenerateK(curve, h1, d, checkSig)
6464

65-
assert.equal(k.toString(), '53')
65+
assert.strictEqual(k.toString(), '53')
6666
}))
6767

6868
fixtures.valid.rfc6979.forEach(function (f) {
@@ -77,9 +77,9 @@ describe('ecdsa', function () {
7777
return results.length === 16
7878
})
7979

80-
assert.equal(results[0].toHex(), f.k0)
81-
assert.equal(results[1].toHex(), f.k1)
82-
assert.equal(results[15].toHex(), f.k15)
80+
assert.strictEqual(results[0].toHex(), f.k0)
81+
assert.strictEqual(results[1].toHex(), f.k1)
82+
assert.strictEqual(results[15].toHex(), f.k15)
8383
})
8484
})
8585
})
@@ -119,7 +119,7 @@ describe('ecdsa', function () {
119119
var Qprime = ecdsa.recoverPubKey(curve, e, signature, i)
120120
var QprimeHex = Qprime.getEncoded().toString('hex')
121121

122-
assert.equal(QprimeHex, expectedHex)
122+
assert.strictEqual(QprimeHex, expectedHex)
123123
})
124124
})
125125
})
@@ -143,8 +143,8 @@ describe('ecdsa', function () {
143143
var hash = crypto.sha256(f.message)
144144
var signature = ecdsa.sign(curve, hash, d)
145145

146-
assert.equal(signature.r.toString(), f.signature.r)
147-
assert.equal(signature.s.toString(), f.signature.s)
146+
assert.strictEqual(signature.r.toString(), f.signature.r)
147+
assert.strictEqual(signature.s.toString(), f.signature.s)
148148
})
149149
})
150150

@@ -177,7 +177,7 @@ describe('ecdsa', function () {
177177
var signature = new ECSignature(new BigInteger(f.signature.r), new BigInteger(f.signature.s))
178178
var Q = curve.G.multiply(d)
179179

180-
assert.equal(ecdsa.verify(curve, H, signature, Q), false)
180+
assert.strictEqual(ecdsa.verify(curve, H, signature, Q), false)
181181
})
182182
})
183183
})

0 commit comments

Comments
 (0)