FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

zlib: Fix invalidly failing test · wave2future/node@975f193 · GitHub

Repository navigation

Commit 975f193

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

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

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

Lines changed: 10 additions & 1 deletion
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)

Back | FazBrowse Home | New Git URL