Skip to content

Commit

Permalink
test: use strictEqual in test-zlib-truncated
Browse files Browse the repository at this point in the history
PR-URL: #9858
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
bencripps authored and addaleax committed Dec 5, 2016
1 parent 3af4ef4 commit eb369f6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions test/parallel/test-zlib-truncated.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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));
});
});
});

0 comments on commit eb369f6

Please sign in to comment.