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.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js
index 1dbe4e2805..98f9b15bfc 100644
--- a/src/node/test/surface_test.js
+++ b/src/node/test/surface_test.js
@@ -343,6 +343,9 @@ describe('Other conditions', function() {
after(function() {
server.shutdown();
});
+ it('channel.getTarget should be available', function() {
+ assert.strictEqual(typeof client.channel.getTarget(), 'string');
+ });
describe('Server recieving bad input', function() {
var misbehavingClient;
var badArg = new Buffer([0xFF]);
@@ -548,6 +551,43 @@ describe('Other conditions', function() {
});
});
});
+ describe('call.getPeer should return the peer', function() {
+ it('for a unary call', function(done) {
+ var call = client.unary({error: false}, function(err, data) {
+ assert.ifError(err);
+ done();
+ });
+ assert.strictEqual(typeof call.getPeer(), 'string');
+ });
+ it('for a client stream call', function(done) {
+ var call = client.clientStream(function(err, data) {
+ assert.ifError(err);
+ done();
+ });
+ assert.strictEqual(typeof call.getPeer(), 'string');
+ call.write({error: false});
+ call.end();
+ });
+ it('for a server stream call', function(done) {
+ var call = client.serverStream({error: false});
+ assert.strictEqual(typeof call.getPeer(), 'string');
+ call.on('data', function(){});
+ call.on('status', function(status) {
+ assert.strictEqual(status.code, grpc.status.OK);
+ done();
+ });
+ });
+ it('for a bidi stream call', function(done) {
+ var call = client.bidiStream();
+ assert.strictEqual(typeof call.getPeer(), 'string');
+ call.write({error: false});
+ call.end();
+ call.on('data', function(){});
+ call.on('status', function(status) {
+ done();
+ });
+ });
+ });
});
describe('Cancelling surface client', function() {
var client;