node/test/parallel/test-uv-binding-constant.js
James M Snell c7962dcba4 src: move process.binding('uv') to internalBinding
PR-URL: https://github.com/nodejs/node/pull/22163
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
2018-08-09 13:47:31 -07:00

21 lines
540 B
JavaScript

// Flags: --expose-internals
'use strict';
require('../common');
const assert = require('assert');
const { internalBinding } = require('internal/test/binding');
const uv = internalBinding('uv');
// Ensures that the `UV_...` values in internalBinding('uv')
// are constants.
const keys = Object.keys(uv);
keys.forEach((key) => {
if (key.startsWith('UV_')) {
const val = uv[key];
assert.throws(() => uv[key] = 1,
/^TypeError: Cannot assign to read only property/);
assert.strictEqual(uv[key], val);
}
});