| 101 | |
| 102 | // TapSync in a pullSync pipeline passes through data and flush |
| 103 | function testTapSyncInPipeline() { |
| 104 | const seen = []; |
| 105 | let sawFlush = false; |
| 106 | const observer = tapSync((chunks) => { |
| 107 | if (chunks === null) { |
| 108 | sawFlush = true; |
| 109 | } else { |
| 110 | for (const chunk of chunks) { |
| 111 | seen.push(new TextDecoder().decode(chunk)); |
| 112 | } |
| 113 | } |
| 114 | }); |
| 115 | |
| 116 | const data = textSync(pullSync(fromSync('hello'), observer)); |
| 117 | assert.strictEqual(data, 'hello'); |
| 118 | assert.strictEqual(seen.length, 1); |
| 119 | assert.strictEqual(seen[0], 'hello'); |
| 120 | assert.strictEqual(sawFlush, true); |
| 121 | } |
| 122 | |
| 123 | Promise.all([ |
| 124 | testTapSync(), |