Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 9 additions & 19 deletions test/parallel/test-zlib-const.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable strict */
'use strict';
require('../common');
const assert = require('assert');

Expand All @@ -9,27 +9,17 @@ 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.throws(() => { zlib.constants.Z_OK = 1; },
TypeError, 'zlib.constants.Z_OK should be immutable');

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.throws(() => { zlib.codes.Z_OK = 1; },
TypeError, 'zlib.codes.Z_OK should be immutable');

assert.throws(() => { zlib.codes = { Z_OK: 1 }; },
TypeError, 'zlib.codes should be immutable');

assert.ok(Object.isFrozen(zlib.codes),
[
Expand Down
Loading