11cb0ef41Sopenharmony_ci// Flags: --no-warnings --expose-internals
21cb0ef41Sopenharmony_ci'use strict';
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_cirequire('../common');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciconst {
71cb0ef41Sopenharmony_ci  ByteLengthQueuingStrategy,
81cb0ef41Sopenharmony_ci  CountQueuingStrategy,
91cb0ef41Sopenharmony_ci} = require('stream/web');
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ciconst {
121cb0ef41Sopenharmony_ci  inspect,
131cb0ef41Sopenharmony_ci} = require('util');
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ciconst {
161cb0ef41Sopenharmony_ci  isPromisePending,
171cb0ef41Sopenharmony_ci} = require('internal/webstreams/util');
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ciconst assert = require('assert');
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ciassert(!isPromisePending({}));
221cb0ef41Sopenharmony_ciassert(!isPromisePending(Promise.resolve()));
231cb0ef41Sopenharmony_ciassert(isPromisePending(new Promise(() => {})));
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ci// Brand checking works
261cb0ef41Sopenharmony_ciassert.throws(() => {
271cb0ef41Sopenharmony_ci  Reflect.get(ByteLengthQueuingStrategy.prototype, 'highWaterMark', {});
281cb0ef41Sopenharmony_ci}, {
291cb0ef41Sopenharmony_ci  code: 'ERR_INVALID_THIS'
301cb0ef41Sopenharmony_ci});
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ciassert.throws(() => {
331cb0ef41Sopenharmony_ci  Reflect.get(ByteLengthQueuingStrategy.prototype, 'size', {});
341cb0ef41Sopenharmony_ci}, {
351cb0ef41Sopenharmony_ci  code: 'ERR_INVALID_THIS'
361cb0ef41Sopenharmony_ci});
371cb0ef41Sopenharmony_ci
381cb0ef41Sopenharmony_ciassert.throws(() => {
391cb0ef41Sopenharmony_ci  Reflect.get(CountQueuingStrategy.prototype, 'highWaterMark', {});
401cb0ef41Sopenharmony_ci}, {
411cb0ef41Sopenharmony_ci  code: 'ERR_INVALID_THIS'
421cb0ef41Sopenharmony_ci});
431cb0ef41Sopenharmony_ci
441cb0ef41Sopenharmony_ciassert.throws(() => {
451cb0ef41Sopenharmony_ci  Reflect.get(CountQueuingStrategy.prototype, 'size', {});
461cb0ef41Sopenharmony_ci}, {
471cb0ef41Sopenharmony_ci  code: 'ERR_INVALID_THIS'
481cb0ef41Sopenharmony_ci});
491cb0ef41Sopenharmony_ci
501cb0ef41Sopenharmony_ci// Custom Inspect Works
511cb0ef41Sopenharmony_ci
521cb0ef41Sopenharmony_ci{
531cb0ef41Sopenharmony_ci  const strategy = new CountQueuingStrategy({ highWaterMark: 1 });
541cb0ef41Sopenharmony_ci
551cb0ef41Sopenharmony_ci  assert.strictEqual(
561cb0ef41Sopenharmony_ci    inspect(strategy, { depth: null }),
571cb0ef41Sopenharmony_ci    'CountQueuingStrategy { highWaterMark: 1 }');
581cb0ef41Sopenharmony_ci
591cb0ef41Sopenharmony_ci  assert.strictEqual(
601cb0ef41Sopenharmony_ci    inspect(strategy),
611cb0ef41Sopenharmony_ci    'CountQueuingStrategy { highWaterMark: 1 }');
621cb0ef41Sopenharmony_ci
631cb0ef41Sopenharmony_ci  assert.strictEqual(
641cb0ef41Sopenharmony_ci    inspect(strategy, { depth: 0 }),
651cb0ef41Sopenharmony_ci    'CountQueuingStrategy [Object]');
661cb0ef41Sopenharmony_ci
671cb0ef41Sopenharmony_ci  assert.strictEqual(
681cb0ef41Sopenharmony_ci    inspect(new ByteLengthQueuingStrategy({ highWaterMark: 1 })),
691cb0ef41Sopenharmony_ci    'ByteLengthQueuingStrategy { highWaterMark: 1 }');
701cb0ef41Sopenharmony_ci}
71