diff options
Diffstat (limited to 'src/node/test/call_test.js')
-rw-r--r-- | src/node/test/call_test.js | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/node/test/call_test.js b/src/node/test/call_test.js index b37c44abaf..dfa9aaa1a7 100644 --- a/src/node/test/call_test.js +++ b/src/node/test/call_test.js @@ -99,25 +99,31 @@ describe('call', function() { }); }); describe('addMetadata', function() { - it('should succeed with objects containing keys and values', function() { + it('should succeed with a map from strings to string arrays', function() { var call = new grpc.Call(channel, 'method', getDeadline(1)); assert.doesNotThrow(function() { - call.addMetadata(); + call.addMetadata({'key': ['value']}); + }); + assert.doesNotThrow(function() { + call.addMetadata({'key1': ['value1'], 'key2': ['value2']}); }); + }); + it('should succeed with a map from strings to buffer arrays', function() { + var call = new grpc.Call(channel, 'method', getDeadline(1)); assert.doesNotThrow(function() { - call.addMetadata({'key' : 'key', - 'value' : new Buffer('value')}); + call.addMetadata({'key': [new Buffer('value')]}); }); assert.doesNotThrow(function() { - call.addMetadata({'key' : 'key1', - 'value' : new Buffer('value1')}, - {'key' : 'key2', - 'value' : new Buffer('value2')}); + call.addMetadata({'key1': [new Buffer('value1')], + 'key2': [new Buffer('value2')]}); }); }); it('should fail with other parameter types', function() { var call = new grpc.Call(channel, 'method', getDeadline(1)); assert.throws(function() { + call.addMetadata(); + }); + assert.throws(function() { call.addMetadata(null); }, TypeError); assert.throws(function() { @@ -133,7 +139,7 @@ describe('call', function() { function() {done();}, 0); assert.throws(function() { - call.addMetadata({'key' : 'key', 'value' : new Buffer('value') }); + call.addMetadata({'key': ['value']}); }, function(err) { return err.code === grpc.callError.ALREADY_INVOKED; }); |