-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add a missing regression test for GH-329 #359
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Though, should we check that no inspect message is sent?
@nechaido PTAL |
test/node/regress-gh-329.js
Outdated
server = jstp.net.createServer([app]); | ||
|
||
server.on('connect', (connection) => { | ||
connection.on('incomingMessage', (message) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can be better to use server's log
event here:
server.on('log', (connection, event) => {
if (event === 'inspect') {
inspectSent = true;
}
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a nit.
Also there is no need in subtest in this case, so the test may be written this way:
'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 messages');
}
});
server.listen(0, () => {
test.plan(4);
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(api).length,
0,
'remote proxy object must be empty'
);
test.assertNot(inspectSent, 'must not send inspect message');
connection.close();
server.close();
}
);
});
test/node/regress-gh-329.js
Outdated
test.equal( | ||
Object.keys(api).length, | ||
0, | ||
'remote proxy object must be empty' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be misleading, as api
is an object that contains RemoteProxy
, but remote proxy object
may be interpreted as 'instance of RemoteProxy
'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Unrelated macOS failure:
|
Add a missing regression test for connectAndInspect with empty array of interfaces.
9495f66
to
963bff6
Compare
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>
Landed in b18215b. |
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>
Add a missing regression test for connectAndInspect with empty array of
interfaces.