()
| 43 | } |
| 44 | |
| 45 | function 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 | |
| 60 | function testShareSyncCancelMidIteration() { |
| 61 | // Verify cancel during iteration stops data flow and cleans up |