From eb369f6d485a5cc270f8cee947f61da88ce2ad2b Mon Sep 17 00:00:00 2001 From: ben_cripps Date: Wed, 30 Nov 2016 10:27:50 -0600 Subject: [PATCH] test: use strictEqual in test-zlib-truncated PR-URL: https://github.com/nodejs/node/pull/9858 Reviewed-By: Rich Trott --- test/parallel/test-zlib-truncated.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-zlib-truncated.js b/test/parallel/test-zlib-truncated.js index 3fac824bbf9e53..92a18a538c1ee4 100644 --- a/test/parallel/test-zlib-truncated.js +++ b/test/parallel/test-zlib-truncated.js @@ -24,17 +24,18 @@ const inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing eli' zlib[methods.comp](inputString, function(err, compressed) { assert(!err); const truncated = compressed.slice(0, compressed.length / 2); + const toUTF8 = (buffer) => buffer.toString('utf-8'); // sync sanity assert.doesNotThrow(function() { const decompressed = zlib[methods.decompSync](compressed); - assert.equal(decompressed, inputString); + assert.strictEqual(toUTF8(decompressed), inputString); }); // async sanity zlib[methods.decomp](compressed, function(err, result) { assert.ifError(err); - assert.equal(result, inputString); + assert.strictEqual(toUTF8(result), inputString); }); // sync truncated input test @@ -51,17 +52,15 @@ const inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing eli' // sync truncated input test, finishFlush = Z_SYNC_FLUSH assert.doesNotThrow(function() { - const result = zlib[methods.decompSync](truncated, syncFlushOpt) - .toString(); - assert.equal(result, inputString.substr(0, result.length)); + const result = toUTF8(zlib[methods.decompSync](truncated, syncFlushOpt)); + assert.strictEqual(result, inputString.substr(0, result.length)); }); // async truncated input test, finishFlush = Z_SYNC_FLUSH zlib[methods.decomp](truncated, syncFlushOpt, function(err, decompressed) { assert.ifError(err); - - const result = decompressed.toString(); - assert.equal(result, inputString.substr(0, result.length)); + const result = toUTF8(decompressed); + assert.strictEqual(result, inputString.substr(0, result.length)); }); }); });