From 8f73ec53e9aa542084ad360755a6f87575c0e943 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 9 Aug 2017 15:40:39 -0700 Subject: [PATCH] refactor: use assert.strictEqual instead of assert.equal. --- bench/mnemonic.js | 2 +- lib/mining/template.js | 12 ++++++------ lib/net/bip151.js | 2 +- lib/net/hostlist.js | 2 +- lib/net/parser.js | 2 +- lib/primitives/mtx.js | 4 ++-- lib/utils/ip.js | 2 +- lib/workers/parser.js | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/bench/mnemonic.js b/bench/mnemonic.js index a2d217a6..ce9f250e 100644 --- a/bench/mnemonic.js +++ b/bench/mnemonic.js @@ -10,7 +10,7 @@ HD.fromMnemonic(mnemonic); const phrase = mnemonic.getPhrase(); -assert.equal(Mnemonic.fromPhrase(phrase).getPhrase(), phrase); +assert.strictEqual(Mnemonic.fromPhrase(phrase).getPhrase(), phrase); { const end = bench('fromPhrase'); diff --git a/lib/mining/template.js b/lib/mining/template.js index 2f3a9644..510cb3ee 100644 --- a/lib/mining/template.js +++ b/lib/mining/template.js @@ -295,13 +295,13 @@ BlockTemplate.prototype.createCoinbase = function createCoinbase(hash) { // CB size = 208 // Sigops cost = 4 if (!this.witness) { - assert.equal(cb.getWeight() + padding * scale, 500); - assert.equal(cb.getBaseSize() + padding, 125); - assert.equal(cb.getSize() + padding, 125); + assert.strictEqual(cb.getWeight() + padding * scale, 500); + assert.strictEqual(cb.getBaseSize() + padding, 125); + assert.strictEqual(cb.getSize() + padding, 125); } else { - assert.equal(cb.getWeight() + padding * scale, 724); - assert.equal(cb.getBaseSize() + padding, 172); - assert.equal(cb.getSize() + padding, 208); + assert.strictEqual(cb.getWeight() + padding * scale, 724); + assert.strictEqual(cb.getBaseSize() + padding, 172); + assert.strictEqual(cb.getSize() + padding, 208); } // Setup coinbase flags (variable size). diff --git a/lib/net/bip151.js b/lib/net/bip151.js index d822aafb..d01516b4 100644 --- a/lib/net/bip151.js +++ b/lib/net/bip151.js @@ -677,7 +677,7 @@ BIP151.prototype.read = function read(size) { off += len; } - assert.equal(off, chunk.length); + assert.strictEqual(off, chunk.length); this.total -= chunk.length; diff --git a/lib/net/hostlist.js b/lib/net/hostlist.js index 7cfef73c..3f0b8d50 100644 --- a/lib/net/hostlist.js +++ b/lib/net/hostlist.js @@ -817,7 +817,7 @@ HostList.prototype.toArray = function toArray() { for (const entry of this.map.values()) out.push(entry.addr); - assert.equal(out.length, this.size()); + assert.strictEqual(out.length, this.size()); return out; }; diff --git a/lib/net/parser.js b/lib/net/parser.js index 2a0ddfb5..94d1ff2f 100644 --- a/lib/net/parser.js +++ b/lib/net/parser.js @@ -75,7 +75,7 @@ Parser.prototype.feed = function feed(data) { off += len; } - assert.equal(off, chunk.length); + assert.strictEqual(off, chunk.length); this.total -= chunk.length; this.parse(chunk); diff --git a/lib/primitives/mtx.js b/lib/primitives/mtx.js index 6c8c86e2..58711b1d 100644 --- a/lib/primitives/mtx.js +++ b/lib/primitives/mtx.js @@ -1228,11 +1228,11 @@ MTX.prototype.fund = async function fund(coins, options) { if (change.isDust(policy.MIN_RELAY)) { // Do nothing. Change is added to fee. this.changeIndex = -1; - assert.equal(this.getFee(), select.fee + select.change); + assert.strictEqual(this.getFee(), select.fee + select.change); } else { this.outputs.push(change); this.changeIndex = this.outputs.length - 1; - assert.equal(this.getFee(), select.fee); + assert.strictEqual(this.getFee(), select.fee); } return select; diff --git a/lib/utils/ip.js b/lib/utils/ip.js index 2fe9cd4d..dc84b915 100644 --- a/lib/utils/ip.js +++ b/lib/utils/ip.js @@ -387,7 +387,7 @@ IP.parseV6 = function parseV6(str, raw, offset) { } assert(missing === 0, 'IPv6 address has missing sections.'); - assert.equal(offset, start + 16); + assert.strictEqual(offset, start + 16); return raw; }; diff --git a/lib/workers/parser.js b/lib/workers/parser.js index b70a2908..26c21788 100644 --- a/lib/workers/parser.js +++ b/lib/workers/parser.js @@ -75,7 +75,7 @@ Parser.prototype.read = function read(size) { off += len; } - assert.equal(off, chunk.length); + assert.strictEqual(off, chunk.length); this.total -= chunk.length;