11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ciif (common.isWindows) {
61cb0ef41Sopenharmony_ci  assert.strictEqual(process.initgroups, undefined);
71cb0ef41Sopenharmony_ci  return;
81cb0ef41Sopenharmony_ci}
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ciif (!common.isMainThread)
111cb0ef41Sopenharmony_ci  return;
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ci[undefined, null, true, {}, [], () => {}].forEach((val) => {
141cb0ef41Sopenharmony_ci  assert.throws(
151cb0ef41Sopenharmony_ci    () => {
161cb0ef41Sopenharmony_ci      process.initgroups(val);
171cb0ef41Sopenharmony_ci    },
181cb0ef41Sopenharmony_ci    {
191cb0ef41Sopenharmony_ci      code: 'ERR_INVALID_ARG_TYPE',
201cb0ef41Sopenharmony_ci      name: 'TypeError',
211cb0ef41Sopenharmony_ci      message:
221cb0ef41Sopenharmony_ci        'The "user" argument must be ' +
231cb0ef41Sopenharmony_ci        'one of type number or string.' +
241cb0ef41Sopenharmony_ci        common.invalidArgTypeHelper(val)
251cb0ef41Sopenharmony_ci    }
261cb0ef41Sopenharmony_ci  );
271cb0ef41Sopenharmony_ci});
281cb0ef41Sopenharmony_ci
291cb0ef41Sopenharmony_ci[undefined, null, true, {}, [], () => {}].forEach((val) => {
301cb0ef41Sopenharmony_ci  assert.throws(
311cb0ef41Sopenharmony_ci    () => {
321cb0ef41Sopenharmony_ci      process.initgroups('foo', val);
331cb0ef41Sopenharmony_ci    },
341cb0ef41Sopenharmony_ci    {
351cb0ef41Sopenharmony_ci      code: 'ERR_INVALID_ARG_TYPE',
361cb0ef41Sopenharmony_ci      name: 'TypeError',
371cb0ef41Sopenharmony_ci      message:
381cb0ef41Sopenharmony_ci        'The "extraGroup" argument must be ' +
391cb0ef41Sopenharmony_ci        'one of type number or string.' +
401cb0ef41Sopenharmony_ci        common.invalidArgTypeHelper(val)
411cb0ef41Sopenharmony_ci    }
421cb0ef41Sopenharmony_ci  );
431cb0ef41Sopenharmony_ci});
441cb0ef41Sopenharmony_ci
451cb0ef41Sopenharmony_ciassert.throws(
461cb0ef41Sopenharmony_ci  () => {
471cb0ef41Sopenharmony_ci    process.initgroups(
481cb0ef41Sopenharmony_ci      'fhqwhgadshgnsdhjsdbkhsdabkfabkveyb',
491cb0ef41Sopenharmony_ci      'fhqwhgadshgnsdhjsdbkhsdabkfabkveyb'
501cb0ef41Sopenharmony_ci    );
511cb0ef41Sopenharmony_ci  },
521cb0ef41Sopenharmony_ci  {
531cb0ef41Sopenharmony_ci    code: 'ERR_UNKNOWN_CREDENTIAL',
541cb0ef41Sopenharmony_ci    message:
551cb0ef41Sopenharmony_ci      'Group identifier does not exist: fhqwhgadshgnsdhjsdbkhsdabkfabkveyb'
561cb0ef41Sopenharmony_ci  }
571cb0ef41Sopenharmony_ci);
58