()
| 20 | // ============================================================================= |
| 21 | |
| 22 | async function testTapSync() { |
| 23 | const observed = []; |
| 24 | const observer = tapSync((chunks) => { |
| 25 | if (chunks !== null) { |
| 26 | observed.push(chunks.length); |
| 27 | } |
| 28 | }); |
| 29 | |
| 30 | // tapSync returns a function transform |
| 31 | assert.strictEqual(typeof observer, 'function'); |
| 32 | |
| 33 | // Test that it passes data through unchanged |
| 34 | const input = [new Uint8Array([1]), new Uint8Array([2])]; |
| 35 | const result = observer(input); |
| 36 | assert.deepStrictEqual(result, input); |
| 37 | assert.deepStrictEqual(observed, [2]); |
| 38 | |
| 39 | // null (flush) passes through |
| 40 | const flushResult = observer(null); |
| 41 | assert.strictEqual(flushResult, null); |
| 42 | } |
| 43 | |
| 44 | async function testTapAsync() { |
| 45 | const observed = []; |
no test coverage detected