Browse Source

test: use strictEqual in test-zlib-truncated

PR-URL: https://github.com/nodejs/node/pull/9858
Reviewed-By: Rich Trott <rtrott@gmail.com>
v6.x
ben_cripps 8 years ago
committed by Anna Henningsen
parent
commit
fcc511a57b
No known key found for this signature in database GPG Key ID: D8B9F5AEAE84E4CF
  1. 15
      test/parallel/test-zlib-truncated.js

15
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));
});
});
});

Loading…
Cancel
Save