MCPcopy
hub / github.com/amqp-node/amqplib / connectionTest

Function connectionTest

test/connection.test.js:13–29  ·  view source on GitHub ↗
(client, server)

Source from the content-addressed store, hash-verified

11const LOG_ERRORS = process.env.LOG_ERRORS;
12
13function 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
31describe('Connection', () => {
32

Callers 1

connection.test.jsFile · 0.85

Calls 4

onMethod · 0.95
latchFunction · 0.85
socketPairFunction · 0.85
runServerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…