Skip to content

Commit

Permalink
test: add a missing regression test for GH-329
Browse files Browse the repository at this point in the history
Add a missing regression test for connectAndInspect with empty array of
interfaces.

PR-URL: #359
Reviewed-By: Dmytro Nechai <nechaido@gmail.com>
Reviewed-By: Mykola Bilochub <nbelochub@gmail.com>
  • Loading branch information
aqrln authored and belochub committed Aug 8, 2018
1 parent fb42f78 commit b18215b
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/node/regress-gh-329.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Regression test for https://github.com/metarhia/jstp/pull/329

'use strict';

const test = require('tap');
const jstp = require('../..');

const app = new jstp.Application('app', {});
const server = jstp.net.createServer([app]);

server.on('log', (connection, event) => {
if (event === 'inspect') {
test.fail('must not send inspect message');
}
});

test.plan(4);

server.listen(0, () => {
jstp.net.connectAndInspect(
app.name,
null,
[],
server.address().port,
(error, connection, api) => {
test.pass('must invoke the callback');
test.assertNot(error, 'must connect to server');
test.equal(
Object.keys(connection.remoteProxies).length,
0,
'no remote proxy instances must be created'
);
test.equal(
Object.keys(api).length,
0,
'no remote proxy instances must be passed to callback'
);
connection.close();
server.close();
}
);
});

0 comments on commit b18215b

Please sign in to comment.