summaryrefslogtreecommitdiff
path: root/test/parallel/test-zlib-const.js
blob: d25a1ca6be033ae0012d11a4536da74afd19a3dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* eslint-disable strict */
require('../common');
const assert = require('assert');

const zlib = require('zlib');

assert.strictEqual(zlib.constants.Z_OK, 0,
                   [
                     'Expected Z_OK to be 0;',
                     `got ${zlib.constants.Z_OK}`
                   ].join(' '));
zlib.constants.Z_OK = 1;
assert.strictEqual(zlib.constants.Z_OK, 0,
                   [
                     'Z_OK should be immutable.',
                     `Expected to get 0, got ${zlib.constants.Z_OK}`
                   ].join(' '));

assert.strictEqual(zlib.codes.Z_OK, 0,
                   `Expected Z_OK to be 0; got ${zlib.codes.Z_OK}`);
zlib.codes.Z_OK = 1;
assert.strictEqual(zlib.codes.Z_OK, 0,
                   [
                     'Z_OK should be immutable.',
                     `Expected to get 0, got ${zlib.codes.Z_OK}`
                   ].join(' '));
zlib.codes = { Z_OK: 1 };
assert.strictEqual(zlib.codes.Z_OK, 0,
                   [
                     'Z_OK should be immutable.',
                     `Expected to get 0, got ${zlib.codes.Z_OK}`
                   ].join(' '));

assert.ok(Object.isFrozen(zlib.codes),
          [
            'Expected zlib.codes to be frozen, but Object.isFrozen',
            `returned ${Object.isFrozen(zlib.codes)}`
          ].join(' '));