forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-zlib-oscode.js
More file actions
22 lines (16 loc) · 849 Bytes
/
Copy pathtest-zlib-oscode.js
File metadata and controls
22 lines (16 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'use strict';
const common = require('../common');
// Assert that the zlib output on MacOS and Linux is identical to what it was
// before the zlib 1.2.11 update. The change was in an unused 'OS code' in the
// header, so is not dependent on the size or content of the data encrypted.
// The test doesn't apply to non-MacOS/Linux platforms, they already had unique
// OS codes prior to the zlib update.
if (process.platform !== 'linux' && process.platform !== 'darwin')
return common.skip('test applies only to Mac and Linux');
const assert = require('assert');
const zlib = require('zlib');
const expected = '1f8b0800000000000003ab00008316dc8c01000000';
const options = {strategy: zlib.Z_DEFAULT_STRATEGY};
zlib.gzip('x', options, common.mustCall(function(err, compressed) {
assert.strictEqual(compressed.toString('hex'), expected);
}));