(client, server)
| 11 | const LOG_ERRORS = process.env.LOG_ERRORS; |
| 12 | |
| 13 | function connectionTest(client, server) { |
| 14 | return (_t, done) => { |
| 15 | const decrementLatch = latch(2, done); |
| 16 | const pair = socketPair(); |
| 17 | const c = new Connection(pair.client); |
| 18 | if (LOG_ERRORS) c.on('error', console.warn); |
| 19 | client(c, decrementLatch); |
| 20 | |
| 21 | // NB only not a race here because the writes are synchronous |
| 22 | const protocolHeader = pair.server.read(8); |
| 23 | assert.deepEqual(Buffer.from(`AMQP${String.fromCharCode(0, 0, 9, 1)}`), protocolHeader); |
| 24 | |
| 25 | runServer(pair.server, (send, wait) => { |
| 26 | server(send, wait, decrementLatch, pair.server); |
| 27 | }); |
| 28 | }; |
| 29 | } |
| 30 | |
| 31 | describe('Connection', () => { |
| 32 |
no test coverage detected
searching dependent graphs…