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.js42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js
index edbfc0a288..5a704ee133 100644
--- a/src/node/test/surface_test.js
+++ b/src/node/test/surface_test.js
@@ -404,18 +404,18 @@ describe('Echo metadata', function() {
server.forceShutdown();
});
it('with unary call', function(done) {
- var call = client.unary({}, function(err, data) {
+ var call = client.unary({}, metadata, function(err, data) {
assert.ifError(err);
- }, metadata);
+ });
call.on('metadata', function(metadata) {
assert.deepEqual(metadata.get('key'), ['value']);
done();
});
});
it('with client stream call', function(done) {
- var call = client.clientStream(function(err, data) {
+ var call = client.clientStream(metadata, function(err, data) {
assert.ifError(err);
- }, metadata);
+ });
call.on('metadata', function(metadata) {
assert.deepEqual(metadata.get('key'), ['value']);
done();
@@ -441,8 +441,8 @@ describe('Echo metadata', function() {
});
it('shows the correct user-agent string', function(done) {
var version = require('../../../package.json').version;
- var call = client.unary({}, function(err, data) { assert.ifError(err); },
- metadata);
+ var call = client.unary({}, metadata,
+ function(err, data) { assert.ifError(err); });
call.on('metadata', function(metadata) {
assert(_.startsWith(metadata.get('user-agent')[0],
'grpc-node/' + version));
@@ -452,8 +452,8 @@ describe('Echo metadata', function() {
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);
+ var call = client.unary({}, dup_metadata,
+ function(err, data) {assert.ifError(err); });
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')),
@@ -954,7 +954,7 @@ describe('Call propagation', function() {
done = multiDone(done, 2);
var call;
proxy_impl.unary = function(parent, callback) {
- client.unary(parent.request, function(err, value) {
+ client.unary(parent.request, {parent: parent}, function(err, value) {
try {
assert(err);
assert.strictEqual(err.code, grpc.status.CANCELLED);
@@ -962,7 +962,7 @@ describe('Call propagation', function() {
callback(err, value);
done();
}
- }, null, {parent: parent});
+ });
call.cancel();
};
proxy.addProtoService(test_service, proxy_impl);
@@ -976,7 +976,7 @@ describe('Call propagation', function() {
done = multiDone(done, 2);
var call;
proxy_impl.clientStream = function(parent, callback) {
- client.clientStream(function(err, value) {
+ client.clientStream({parent: parent}, function(err, value) {
try {
assert(err);
assert.strictEqual(err.code, grpc.status.CANCELLED);
@@ -984,7 +984,7 @@ describe('Call propagation', function() {
callback(err, value);
done();
}
- }, null, {parent: parent});
+ });
call.cancel();
};
proxy.addProtoService(test_service, proxy_impl);
@@ -998,8 +998,7 @@ describe('Call propagation', function() {
done = multiDone(done, 2);
var call;
proxy_impl.serverStream = function(parent) {
- var child = client.serverStream(parent.request, null,
- {parent: parent});
+ var child = client.serverStream(parent.request, {parent: parent});
child.on('data', function() {});
child.on('error', function(err) {
assert(err);
@@ -1023,7 +1022,7 @@ describe('Call propagation', function() {
done = multiDone(done, 2);
var call;
proxy_impl.bidiStream = function(parent) {
- var child = client.bidiStream(null, {parent: parent});
+ var child = client.bidiStream({parent: parent});
child.on('data', function() {});
child.on('error', function(err) {
assert(err);
@@ -1051,7 +1050,8 @@ describe('Call propagation', function() {
it('With a client stream call', function(done) {
done = multiDone(done, 2);
proxy_impl.clientStream = function(parent, callback) {
- client.clientStream(function(err, value) {
+ var options = {parent: parent, propagate_flags: deadline_flags};
+ client.clientStream(options, function(err, value) {
try {
assert(err);
assert(err.code === grpc.status.DEADLINE_EXCEEDED ||
@@ -1060,7 +1060,7 @@ describe('Call propagation', function() {
callback(err, value);
done();
}
- }, null, {parent: parent, propagate_flags: deadline_flags});
+ });
};
proxy.addProtoService(test_service, proxy_impl);
var proxy_port = proxy.bind('localhost:0', server_insecure_creds);
@@ -1069,15 +1069,15 @@ describe('Call propagation', function() {
grpc.credentials.createInsecure());
var deadline = new Date();
deadline.setSeconds(deadline.getSeconds() + 1);
- proxy_client.clientStream(function(err, value) {
+ proxy_client.clientStream({deadline: deadline}, function(err, value) {
done();
- }, null, {deadline: deadline});
+ });
});
it('With a bidi stream call', function(done) {
done = multiDone(done, 2);
proxy_impl.bidiStream = function(parent) {
var child = client.bidiStream(
- null, {parent: parent, propagate_flags: deadline_flags});
+ {parent: parent, propagate_flags: deadline_flags});
child.on('data', function() {});
child.on('error', function(err) {
assert(err);
@@ -1093,7 +1093,7 @@ describe('Call propagation', function() {
grpc.credentials.createInsecure());
var deadline = new Date();
deadline.setSeconds(deadline.getSeconds() + 1);
- var call = proxy_client.bidiStream(null, {deadline: deadline});
+ var call = proxy_client.bidiStream({deadline: deadline});
call.on('data', function() {});
call.on('error', function(err) {
done();