aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node/test/surface_test.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/node/test/surface_test.js')
-rw-r--r--src/node/test/surface_test.js35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js
index 7c2a8d7258..d917c7a171 100644
--- a/src/node/test/surface_test.js
+++ b/src/node/test/surface_test.js
@@ -133,7 +133,25 @@ describe('Server.prototype.addProtoService', function() {
});
});
});
-describe('Client#$waitForReady', function() {
+describe('Client constructor building', function() {
+ var illegal_service_attrs = {
+ $method : {
+ path: '/illegal/$method',
+ requestStream: false,
+ responseStream: false,
+ requestSerialize: _.identity,
+ requestDeserialize: _.identity,
+ responseSerialize: _.identity,
+ responseDeserialize: _.identity
+ }
+ };
+ it('Should reject method names starting with $', function() {
+ assert.throws(function() {
+ grpc.makeGenericClientConstructor(illegal_service_attrs);
+ }, /\$/);
+ });
+});
+describe('waitForClientReady', function() {
var server;
var port;
var Client;
@@ -151,13 +169,13 @@ describe('Client#$waitForReady', function() {
server.forceShutdown();
});
it('should complete when called alone', function(done) {
- client.$waitForReady(Infinity, function(error) {
+ grpc.waitForClientReady(client, Infinity, function(error) {
assert.ifError(error);
done();
});
});
it('should complete when a call is initiated', function(done) {
- client.$waitForReady(Infinity, function(error) {
+ grpc.waitForClientReady(client, Infinity, function(error) {
assert.ifError(error);
done();
});
@@ -166,19 +184,19 @@ describe('Client#$waitForReady', function() {
});
it('should complete if called more than once', function(done) {
done = multiDone(done, 2);
- client.$waitForReady(Infinity, function(error) {
+ grpc.waitForClientReady(client, Infinity, function(error) {
assert.ifError(error);
done();
});
- client.$waitForReady(Infinity, function(error) {
+ grpc.waitForClientReady(client, Infinity, function(error) {
assert.ifError(error);
done();
});
});
it('should complete if called when already ready', function(done) {
- client.$waitForReady(Infinity, function(error) {
+ grpc.waitForClientReady(client, Infinity, function(error) {
assert.ifError(error);
- client.$waitForReady(Infinity, function(error) {
+ grpc.waitForClientReady(client, Infinity, function(error) {
assert.ifError(error);
done();
});
@@ -426,7 +444,8 @@ describe('Other conditions', function() {
server.forceShutdown();
});
it('channel.getTarget should be available', function() {
- assert.strictEqual(typeof client.channel.getTarget(), 'string');
+ assert.strictEqual(typeof grpc.getClientChannel(client).getTarget(),
+ 'string');
});
describe('Server recieving bad input', function() {
var misbehavingClient;