|
|
|
@ -344,6 +344,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]); |
|
|
|
@ -549,6 +552,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; |
|
|
|
|