11cb0ef41Sopenharmony_ci// Flags: --expose-internals
21cb0ef41Sopenharmony_ci'use strict';
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_cirequire('../common');
51cb0ef41Sopenharmony_ciconst { internalBinding } = require('internal/test/binding');
61cb0ef41Sopenharmony_ciconst constants = internalBinding('constants');
71cb0ef41Sopenharmony_ciconst assert = require('assert');
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciassert.deepStrictEqual(
101cb0ef41Sopenharmony_ci  Object.keys(constants).sort(), ['crypto', 'fs', 'os', 'trace', 'zlib']
111cb0ef41Sopenharmony_ci);
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciassert.deepStrictEqual(
141cb0ef41Sopenharmony_ci  Object.keys(constants.os).sort(), ['UV_UDP_REUSEADDR', 'dlopen', 'errno',
151cb0ef41Sopenharmony_ci                                     'priority', 'signals']
161cb0ef41Sopenharmony_ci);
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ci// Make sure all the constants objects don't inherit from Object.prototype
191cb0ef41Sopenharmony_ciconst inheritedProperties = Object.getOwnPropertyNames(Object.prototype);
201cb0ef41Sopenharmony_cifunction test(obj) {
211cb0ef41Sopenharmony_ci  assert(obj);
221cb0ef41Sopenharmony_ci  assert.strictEqual(Object.prototype.toString.call(obj), '[object Object]');
231cb0ef41Sopenharmony_ci  assert.strictEqual(Object.getPrototypeOf(obj), null);
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ci  inheritedProperties.forEach((property) => {
261cb0ef41Sopenharmony_ci    assert.strictEqual(property in obj, false);
271cb0ef41Sopenharmony_ci  });
281cb0ef41Sopenharmony_ci}
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci[
311cb0ef41Sopenharmony_ci  constants, constants.crypto, constants.fs, constants.os, constants.trace,
321cb0ef41Sopenharmony_ci  constants.zlib, constants.os.dlopen, constants.os.errno, constants.os.signals,
331cb0ef41Sopenharmony_ci].forEach(test);
34