Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eb369f6

Browse filesBrowse files
bencrippsaddaleax
authored andcommitted
test: use strictEqual in test-zlib-truncated
PR-URL: #9858 Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 3af4ef4 commit eb369f6
Copy full SHA for eb369f6

File tree

Expand file treeCollapse file tree

1 file changed

+7
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-8
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-zlib-truncated.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-zlib-truncated.js
+7-8Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,18 @@ const inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing eli'
2424
zlib[methods.comp](inputString, function(err, compressed) {
2525
assert(!err);
2626
const truncated = compressed.slice(0, compressed.length / 2);
27+
const toUTF8 = (buffer) => buffer.toString('utf-8');
2728

2829
// sync sanity
2930
assert.doesNotThrow(function() {
3031
const decompressed = zlib[methods.decompSync](compressed);
31-
assert.equal(decompressed, inputString);
32+
assert.strictEqual(toUTF8(decompressed), inputString);
3233
});
3334

3435
// async sanity
3536
zlib[methods.decomp](compressed, function(err, result) {
3637
assert.ifError(err);
37-
assert.equal(result, inputString);
38+
assert.strictEqual(toUTF8(result), inputString);
3839
});
3940

4041
// sync truncated input test
@@ -51,17 +52,15 @@ const inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing eli'
5152

5253
// sync truncated input test, finishFlush = Z_SYNC_FLUSH
5354
assert.doesNotThrow(function() {
54-
const result = zlib[methods.decompSync](truncated, syncFlushOpt)
55-
.toString();
56-
assert.equal(result, inputString.substr(0, result.length));
55+
const result = toUTF8(zlib[methods.decompSync](truncated, syncFlushOpt));
56+
assert.strictEqual(result, inputString.substr(0, result.length));
5757
});
5858

5959
// async truncated input test, finishFlush = Z_SYNC_FLUSH
6060
zlib[methods.decomp](truncated, syncFlushOpt, function(err, decompressed) {
6161
assert.ifError(err);
62-
63-
const result = decompressed.toString();
64-
assert.equal(result, inputString.substr(0, result.length));
62+
const result = toUTF8(decompressed);
63+
assert.strictEqual(result, inputString.substr(0, result.length));
6564
});
6665
});
6766
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.