aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2015-10-12 16:12:18 -0700
committerGravatar murgatroid99 <mlumish@google.com>2015-10-12 16:12:18 -0700
commit71f50361bfdc60f3f293c38189e46c3bed43440e (patch)
tree861aed689250eed6c5fcb2235748a0dd9c31564a /src
parent75a2bbaab2ed7c06c7655c69b00bb89a5c2d3448 (diff)
Added some more tests to increase coverage
Diffstat (limited to 'src')
-rw-r--r--src/node/test/call_test.js6
-rw-r--r--src/node/test/channel_test.js6
-rw-r--r--src/node/test/surface_test.js12
3 files changed, 24 insertions, 0 deletions
diff --git a/src/node/test/call_test.js b/src/node/test/call_test.js
index b7f4f56510..f1f86b35db 100644
--- a/src/node/test/call_test.js
+++ b/src/node/test/call_test.js
@@ -107,6 +107,12 @@ describe('call', function() {
new grpc.Call(channel, 'method', 'now');
}, 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() {
it('should time out immediately with negative deadline', function(done) {
diff --git a/src/node/test/channel_test.js b/src/node/test/channel_test.js
index 5bcf63ee50..7163a5fb5e 100644
--- a/src/node/test/channel_test.js
+++ b/src/node/test/channel_test.js
@@ -104,6 +104,12 @@ describe('channel', function() {
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() {
var channel;
diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js
index 71801c38dd..8aa76fd1ef 100644
--- a/src/node/test/surface_test.js
+++ b/src/node/test/surface_test.js
@@ -365,6 +365,18 @@ describe('Echo metadata', function() {
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() {
var test_service;