|
1 |
| -/* eslint-disable strict */ |
| 1 | +'use strict'; |
2 | 2 | require('../common');
|
3 | 3 | const assert = require('assert');
|
4 | 4 |
|
@@ -9,27 +9,17 @@ assert.strictEqual(zlib.constants.Z_OK, 0,
|
9 | 9 | 'Expected Z_OK to be 0;',
|
10 | 10 | `got ${zlib.constants.Z_OK}`,
|
11 | 11 | ].join(' '));
|
12 |
| -zlib.constants.Z_OK = 1; |
13 |
| -assert.strictEqual(zlib.constants.Z_OK, 0, |
14 |
| -[ |
15 |
| -'Z_OK should be immutable.', |
16 |
| -`Expected to get 0, got ${zlib.constants.Z_OK}`, |
17 |
| -].join(' ')); |
| 12 | + |
| 13 | +assert.throws(() => { zlib.constants.Z_OK = 1; }, |
| 14 | +TypeError, 'zlib.constants.Z_OK should be immutable'); |
18 | 15 |
|
19 | 16 | assert.strictEqual(zlib.codes.Z_OK, 0,
|
20 | 17 | `Expected Z_OK to be 0; got ${zlib.codes.Z_OK}`);
|
21 |
| -zlib.codes.Z_OK = 1; |
22 |
| -assert.strictEqual(zlib.codes.Z_OK, 0, |
23 |
| -[ |
24 |
| -'Z_OK should be immutable.', |
25 |
| -`Expected to get 0, got ${zlib.codes.Z_OK}`, |
26 |
| -].join(' ')); |
27 |
| -zlib.codes = { Z_OK: 1 }; |
28 |
| -assert.strictEqual(zlib.codes.Z_OK, 0, |
29 |
| -[ |
30 |
| -'Z_OK should be immutable.', |
31 |
| -`Expected to get 0, got ${zlib.codes.Z_OK}`, |
32 |
| -].join(' ')); |
| 18 | +assert.throws(() => { zlib.codes.Z_OK = 1; }, |
| 19 | +TypeError, 'zlib.codes.Z_OK should be immutable'); |
| 20 | + |
| 21 | +assert.throws(() => { zlib.codes = { Z_OK: 1 }; }, |
| 22 | +TypeError, 'zlib.codes should be immutable'); |
33 | 23 |
|
34 | 24 | assert.ok(Object.isFrozen(zlib.codes),
|
35 | 25 | [
|
|
0 commit comments