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

Function baseChannelTest

test/channel.test.js:15–35  ·  view source on GitHub ↗
(client, server)

Source from the content-addressed store, hash-verified

13const LOG_ERRORS = process.env.LOG_ERRORS;
14
15function baseChannelTest(client, server) {
16 return (_t, done) => {
17 const decrementLatch = latch(2, done);
18 const pair = util.socketPair();
19 const c = new Connection(pair.client);
20
21 if (LOG_ERRORS) c.on('error', console.warn);
22
23 c.open(OPEN_OPTS, (err, _ok) => {
24 if (err === null) client(c, decrementLatch);
25 else decrementLatch(err);
26 });
27
28 pair.server.read(8); // discard the protocol header
29 util.runServer(pair.server, (send, wait) => {
30 handshake(send, wait).then(() => {
31 server(send, wait, decrementLatch);
32 }, decrementLatch);
33 });
34 };
35}
36
37function channelTest(client, server) {
38 return baseChannelTest(

Callers 2

channelTestFunction · 0.85
channel.test.jsFile · 0.85

Calls 4

onMethod · 0.95
openMethod · 0.95
latchFunction · 0.85
handshakeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…