MCPcopy Create free account
hub / github.com/nodejs/node / testShareSyncCancel

Function testShareSyncCancel

test/parallel/test-stream-iter-share-sync.js:45–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43}
44
45function testShareSyncCancel() {
46 // Verify that cancel() on a pre-iteration share yields nothing
47 const shared = shareSync(fromSync('data'));
48 const consumer = shared.pull();
49
50 shared.cancel();
51 assert.strictEqual(shared.consumerCount, 0);
52
53 const batches = [];
54 for (const batch of consumer) {
55 batches.push(batch);
56 }
57 assert.strictEqual(batches.length, 0);
58}
59
60function testShareSyncCancelMidIteration() {
61 // Verify cancel during iteration stops data flow and cleans up

Callers 1

Calls 5

shareSyncFunction · 0.85
fromSyncFunction · 0.50
pullMethod · 0.45
cancelMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected