Skip to content
This repository was archived by the owner on May 20, 2024. It is now read-only.

Commit d855366

Browse files
committed
prepare a backpressure test
1 parent 7e9e89d commit d855366

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,21 @@ test('AWSApiReadStream - returning null or undefined will stop execution', async
4848
})
4949

5050
test.skip('AWSApiReadStream - backpressure', async t => {
51+
const testapi = new TestAPI()
52+
53+
testapi.push = chunk => {
54+
testapi.super.push(chunk)
55+
return count++ !== 2
56+
}
57+
58+
const stream = AWSApiReadStream.from(nextToken => testapi.anAPICall(nextToken))
59+
60+
const results = []
61+
for await (const { data, NextToken } of stream) {
62+
results.push(data)
63+
}
5164

65+
console.log(results)
5266
})
5367

5468
class TestAPI {

0 commit comments

Comments
 (0)