| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,7 +34,16 @@ zlib.deflate(inputString, function(err, buffer) { | |||
| 34 | 34 | }); | |
| 35 | 35 | ||
| 36 | 36 | 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 | + }); | ||
| 38 | 47 | }); | |
| 39 | 48 | ||
| 40 | 49 | var buffer = new Buffer(expectedBase64Deflate, 'base64'); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments