From e543b0e95e71539fe1f50bb59df4c24b46ab93f1 Mon Sep 17 00:00:00 2001 From: isaacs Date: Fri, 18 Nov 2011 14:38:18 -0800 Subject: [PATCH] zlib: Fix invalidly failing test --- test/simple/test-zlib-from-string.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/simple/test-zlib-from-string.js b/test/simple/test-zlib-from-string.js index 1fda405a7b6..fe4fb498407 100644 --- a/test/simple/test-zlib-from-string.js +++ b/test/simple/test-zlib-from-string.js @@ -34,7 +34,16 @@ zlib.deflate(inputString, function(err, buffer) { }); zlib.gzip(inputString, function(err, buffer) { - assert.equal(buffer.toString('base64'), expectedBase64Gzip, 'gzip encoded string should match'); + // Can't actually guarantee that we'll get exactly the same + // deflated bytes when we compress a string, since the header + // depends on stuff other than the input string itself. + // However, decrypting it should definitely yield the same + // result that we're expecting, and this should match what we get + // from inflating the known valid deflate data. + zlib.gunzip(buffer, function (err, gunzipped) { + assert.equal(gunzipped.toString(), inputString, + 'Should get original string after gzip/gunzip'); + }); }); var buffer = new Buffer(expectedBase64Deflate, 'base64');