1'use strict';
2const common = require('../common');
3const { Readable } = require('stream');
4
5// readable.resume() should not lead to a ._read() call being scheduled
6// when we exceed the high water mark already.
7
8const readable = new Readable({
9  read: common.mustNotCall(),
10  highWaterMark: 100
11});
12
13// Fill up the internal buffer so that we definitely exceed the HWM:
14for (let i = 0; i < 10; i++)
15  readable.push('a'.repeat(200));
16
17// Call resume, and pause after one chunk.
18// The .pause() is just so that we don’t empty the buffer fully, which would
19// be a valid reason to call ._read().
20readable.resume();
21readable.once('data', common.mustCall(() => readable.pause()));
22