(response: Buffer, options?: Pick<DuplexOptions, "destroy">)
| 754 | |
| 755 | // A backend that completes startup and answers every Parse with `response`. |
| 756 | const backend = (response: Buffer, options?: Pick<DuplexOptions, "destroy">) => { |
| 757 | let startup = true |
| 758 | const socket: Duplex = new Duplex({ |
| 759 | ...options, |
| 760 | read() {}, |
| 761 | write(chunk: Buffer, _encoding, callback) { |
| 762 | if (startup) { |
| 763 | startup = false |
| 764 | queueMicrotask(() => socket.push(ready)) |
| 765 | } else if (chunk[0] === 0x50) { |
| 766 | queueMicrotask(() => socket.push(response)) |
| 767 | } |
| 768 | callback() |
| 769 | } |
| 770 | }) |
| 771 | return socket |
| 772 | } |
| 773 | |
| 774 | it.effect.each([ |
| 775 | { |
no outgoing calls
no test coverage detected