11cb0ef41Sopenharmony_ci// Flags: --expose-internals
21cb0ef41Sopenharmony_ci'use strict';
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_ciconst common = require('../common');
51cb0ef41Sopenharmony_ciconst assert = require('assert');
61cb0ef41Sopenharmony_ciconst {
71cb0ef41Sopenharmony_ci  assertIsObject,
81cb0ef41Sopenharmony_ci  assertWithinRange,
91cb0ef41Sopenharmony_ci} = require('internal/http2/util');
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ci[
121cb0ef41Sopenharmony_ci  undefined,
131cb0ef41Sopenharmony_ci  {},
141cb0ef41Sopenharmony_ci  Object.create(null),
151cb0ef41Sopenharmony_ci  new Date(),
161cb0ef41Sopenharmony_ci  new (class Foo {})(),
171cb0ef41Sopenharmony_ci].forEach((input) => {
181cb0ef41Sopenharmony_ci  assertIsObject(input, 'foo', 'Object');
191cb0ef41Sopenharmony_ci});
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ci[
221cb0ef41Sopenharmony_ci  1,
231cb0ef41Sopenharmony_ci  false,
241cb0ef41Sopenharmony_ci  'hello',
251cb0ef41Sopenharmony_ci  NaN,
261cb0ef41Sopenharmony_ci  Infinity,
271cb0ef41Sopenharmony_ci  [],
281cb0ef41Sopenharmony_ci  [{}],
291cb0ef41Sopenharmony_ci].forEach((input) => {
301cb0ef41Sopenharmony_ci  assert.throws(
311cb0ef41Sopenharmony_ci    () => assertIsObject(input, 'foo', 'Object'),
321cb0ef41Sopenharmony_ci    {
331cb0ef41Sopenharmony_ci      code: 'ERR_INVALID_ARG_TYPE',
341cb0ef41Sopenharmony_ci      message: 'The "foo" argument must be of type object.' +
351cb0ef41Sopenharmony_ci                common.invalidArgTypeHelper(input)
361cb0ef41Sopenharmony_ci    });
371cb0ef41Sopenharmony_ci});
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ciassertWithinRange('foo', 1, 0, 2);
401cb0ef41Sopenharmony_ci
411cb0ef41Sopenharmony_ciassert.throws(() => assertWithinRange('foo', 1, 2, 3),
421cb0ef41Sopenharmony_ci              {
431cb0ef41Sopenharmony_ci                code: 'ERR_HTTP2_INVALID_SETTING_VALUE',
441cb0ef41Sopenharmony_ci                message: 'Invalid value for setting "foo": 1'
451cb0ef41Sopenharmony_ci              });
46