Skip to content

Commit 975f193

Browse files
committed
zlib: Fix invalidly failing test
1 parent f004d5a commit 975f193

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/simple/test-zlib-from-string.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,16 @@ zlib.deflate(inputString, function(err, buffer) {
3434
});
3535

3636
zlib.gzip(inputString, function(err, buffer) {
37-
assert.equal(buffer.toString('base64'), expectedBase64Gzip, 'gzip encoded string should match');
37+
// Can't actually guarantee that we'll get exactly the same
38+
// deflated bytes when we compress a string, since the header
39+
// depends on stuff other than the input string itself.
40+
// However, decrypting it should definitely yield the same
41+
// result that we're expecting, and this should match what we get
42+
// from inflating the known valid deflate data.
43+
zlib.gunzip(buffer, function (err, gunzipped) {
44+
assert.equal(gunzipped.toString(), inputString,
45+
'Should get original string after gzip/gunzip');
46+
});
3847
});
3948

4049
var buffer = new Buffer(expectedBase64Deflate, 'base64');

0 commit comments

Comments
 (0)