1// Flags: --expose-internals 2'use strict'; 3 4require('../common'); 5const assert = require('assert'); 6const WrapStream = require('internal/js_stream_socket'); 7const Stream = require('stream'); 8 9class FakeStream extends Stream { 10 constructor() { 11 super(); 12 this._paused = false; 13 } 14 15 pause() { 16 this._paused = true; 17 } 18 19 resume() { 20 this._paused = false; 21 } 22 23 isPaused() { 24 return this._paused; 25 } 26} 27 28const fakeStreamObj = new FakeStream(); 29const wrappedStream = new WrapStream(fakeStreamObj); 30 31// Resume by wrapped stream upon construction 32assert.strictEqual(fakeStreamObj.isPaused(), false); 33 34fakeStreamObj.pause(); 35 36assert.strictEqual(fakeStreamObj.isPaused(), true); 37 38fakeStreamObj.resume(); 39 40assert.strictEqual(wrappedStream.readStop(), 0); 41 42assert.strictEqual(fakeStreamObj.isPaused(), true); 43