| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3135455 commit 86e3936
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,11 +12,15 @@ let data = Buffer.concat([ | |||
| 12 | 12 | Buffer(10).fill(0) | |
| 13 | 13 | ]); | |
| 14 | 14 | ||
| 15 | - assert.equal(zlib.gunzipSync(data).toString(), 'abcdef'); | ||
| 15 | + assert.strictEqual(zlib.gunzipSync(data).toString(), 'abcdef'); | ||
| 16 | 16 | ||
| 17 | 17 | zlib.gunzip(data, common.mustCall((err, result) => { | |
| 18 | 18 | assert.ifError(err); | |
| 19 | - assert.equal(result, 'abcdef', 'result should match original string'); | ||
| 19 | + assert.strictEqual( | ||
| 20 | + result.toString(), | ||
| 21 | + 'abcdef', | ||
| 22 | + 'result should match original string' | ||
| 23 | + ); | ||
| 20 | 24 | })); | |
| 21 | 25 | ||
| 22 | 26 | // if the trailing garbage happens to look like a gzip header, it should | |
@@ -28,10 +32,16 @@ data = Buffer.concat([ | |||
| 28 | 32 | Buffer(10).fill(0) | |
| 29 | 33 | ]); | |
| 30 | 34 | ||
| 31 | - assert.throws(() => zlib.gunzipSync(data)); | ||
| 35 | + assert.throws( | ||
| 36 | + () => zlib.gunzipSync(data), | ||
| 37 | + /^Error: unknown compression method$/ | ||
| 38 | + ); | ||
| 32 | 39 | ||
| 33 | 40 | zlib.gunzip(data, common.mustCall((err, result) => { | |
| 34 | - assert(err); | ||
| 41 | + assert(err instanceof Error); | ||
| 42 | + assert.strictEqual(err.code, 'Z_DATA_ERROR'); | ||
| 43 | + assert.strictEqual(err.message, 'unknown compression method'); | ||
| 44 | + assert.strictEqual(result, undefined); | ||
| 35 | 45 | })); | |
| 36 | 46 | ||
| 37 | 47 | // In this case the trailing junk is too short to be a gzip segment | |
@@ -42,8 +52,14 @@ data = Buffer.concat([ | |||
| 42 | 52 | Buffer([0x1f, 0x8b, 0xff, 0xff]) | |
| 43 | 53 | ]); | |
| 44 | 54 | ||
| 45 | - assert.throws(() => zlib.gunzipSync(data)); | ||
| 55 | + assert.throws( | ||
| 56 | + () => zlib.gunzipSync(data), | ||
| 57 | + /^Error: unknown compression method$/ | ||
| 58 | + ); | ||
| 46 | 59 | ||
| 47 | 60 | zlib.gunzip(data, common.mustCall((err, result) => { | |
| 48 | - assert(err); | ||
| 61 | + assert(err instanceof Error); | ||
| 62 | + assert.strictEqual(err.code, 'Z_DATA_ERROR'); | ||
| 63 | + assert.strictEqual(err.message, 'unknown compression method'); | ||
| 64 | + assert.strictEqual(result, undefined); | ||
| 49 | 65 | })); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments