Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: enforce strict mode in test-zlib-const #56689

Merged
merged 1 commit into from
Jan 24, 2025
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