mirror of https://github.com/grpc/grpc-node.git
Added some more tests to increase coverage
This commit is contained in:
parent
d84ad122f9
commit
f5ffc860a8
|
@ -107,6 +107,12 @@ describe('call', function() {
|
||||||
new grpc.Call(channel, 'method', 'now');
|
new grpc.Call(channel, 'method', 'now');
|
||||||
}, TypeError);
|
}, TypeError);
|
||||||
});
|
});
|
||||||
|
it('should succeed without the new keyword', function() {
|
||||||
|
assert.doesNotThrow(function() {
|
||||||
|
var call = grpc.Call(channel, 'method', new Date());
|
||||||
|
assert(call instanceof grpc.Call);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe('deadline', function() {
|
describe('deadline', function() {
|
||||||
it('should time out immediately with negative deadline', function(done) {
|
it('should time out immediately with negative deadline', function(done) {
|
||||||
|
|
|
@ -104,6 +104,12 @@ describe('channel', function() {
|
||||||
new grpc.Channel('hostname', insecureCreds, {'key' : new Date()});
|
new grpc.Channel('hostname', insecureCreds, {'key' : new Date()});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
it('should succeed without the new keyword', function() {
|
||||||
|
assert.doesNotThrow(function() {
|
||||||
|
var channel = grpc.Channel('hostname', insecureCreds);
|
||||||
|
assert(channel instanceof grpc.Channel);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe('close', function() {
|
describe('close', function() {
|
||||||
var channel;
|
var channel;
|
||||||
|
|
|
@ -365,6 +365,18 @@ describe('Echo metadata', function() {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
it('properly handles duplicate values', function(done) {
|
||||||
|
var dup_metadata = metadata.clone();
|
||||||
|
dup_metadata.add('key', 'value2');
|
||||||
|
var call = client.unary({}, function(err, data) {assert.ifError(err); },
|
||||||
|
dup_metadata);
|
||||||
|
call.on('metadata', function(resp_metadata) {
|
||||||
|
// Two arrays are equal iff their symmetric difference is empty
|
||||||
|
assert.deepEqual(_.xor(dup_metadata.get('key'), resp_metadata.get('key')),
|
||||||
|
[]);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe('Other conditions', function() {
|
describe('Other conditions', function() {
|
||||||
var test_service;
|
var test_service;
|
||||||
|
|
Loading…
Reference in New Issue