11cb0ef41Sopenharmony_ci// Flags: --expose-internals
21cb0ef41Sopenharmony_ci'use strict';
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_cirequire('../common');
51cb0ef41Sopenharmony_ciconst { internalBinding } = require('internal/test/binding');
61cb0ef41Sopenharmony_ciconst binding = internalBinding('constants');
71cb0ef41Sopenharmony_ciconst constants = require('constants');
81cb0ef41Sopenharmony_ciconst assert = require('assert');
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ciassert.ok(binding);
111cb0ef41Sopenharmony_ciassert.ok(binding.os);
121cb0ef41Sopenharmony_ciassert.ok(binding.os.signals);
131cb0ef41Sopenharmony_ciassert.ok(binding.os.errno);
141cb0ef41Sopenharmony_ciassert.ok(binding.fs);
151cb0ef41Sopenharmony_ciassert.ok(binding.crypto);
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ci['os', 'fs', 'crypto'].forEach((l) => {
181cb0ef41Sopenharmony_ci  Object.keys(binding[l]).forEach((k) => {
191cb0ef41Sopenharmony_ci    if (typeof binding[l][k] === 'object') { // errno and signals
201cb0ef41Sopenharmony_ci      Object.keys(binding[l][k]).forEach((j) => {
211cb0ef41Sopenharmony_ci        assert.strictEqual(binding[l][k][j], constants[j]);
221cb0ef41Sopenharmony_ci      });
231cb0ef41Sopenharmony_ci    }
241cb0ef41Sopenharmony_ci    if (l !== 'os') { // Top level os constant isn't currently copied
251cb0ef41Sopenharmony_ci      assert.strictEqual(binding[l][k], constants[k]);
261cb0ef41Sopenharmony_ci    }
271cb0ef41Sopenharmony_ci  });
281cb0ef41Sopenharmony_ci});
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ciassert.ok(Object.isFrozen(constants));
31