|
|
@ -192,7 +192,6 @@ describe('Other conditions', function() { |
|
|
|
TestService: { |
|
|
|
TestService: { |
|
|
|
unary: function(call, cb) { |
|
|
|
unary: function(call, cb) { |
|
|
|
var req = call.request; |
|
|
|
var req = call.request; |
|
|
|
debugger; |
|
|
|
|
|
|
|
if (req.error) { |
|
|
|
if (req.error) { |
|
|
|
cb(new Error('Requested error'), null, {metadata: ['yes']}); |
|
|
|
cb(new Error('Requested error'), null, {metadata: ['yes']}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -297,7 +296,7 @@ describe('Other conditions', function() { |
|
|
|
misbehavingClient = new Client('localhost:' + port); |
|
|
|
misbehavingClient = new Client('localhost:' + port); |
|
|
|
}); |
|
|
|
}); |
|
|
|
it('should respond correctly to a unary call', function(done) { |
|
|
|
it('should respond correctly to a unary call', function(done) { |
|
|
|
var call = misbehavingClient.unary(badArg, function(err, data) { |
|
|
|
misbehavingClient.unary(badArg, function(err, data) { |
|
|
|
assert(err); |
|
|
|
assert(err); |
|
|
|
assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT); |
|
|
|
assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT); |
|
|
|
done(); |
|
|
|
done(); |
|
|
@ -310,11 +309,13 @@ describe('Other conditions', function() { |
|
|
|
done(); |
|
|
|
done(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
call.write(badArg); |
|
|
|
call.write(badArg); |
|
|
|
|
|
|
|
// TODO(mlumish): Remove call.end()
|
|
|
|
|
|
|
|
call.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
it('should respond correctly to a server stream', function(done) { |
|
|
|
it('should respond correctly to a server stream', function(done) { |
|
|
|
var call = misbehavingClient.serverStream(badArg); |
|
|
|
var call = misbehavingClient.serverStream(badArg); |
|
|
|
call.on('data', function(data) { |
|
|
|
call.on('data', function(data) { |
|
|
|
assert.fail(data, null, 'Unexpected data', '!='); |
|
|
|
assert.fail(data, null, 'Unexpected data', '==='); |
|
|
|
}); |
|
|
|
}); |
|
|
|
call.on('error', function(err) { |
|
|
|
call.on('error', function(err) { |
|
|
|
assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT); |
|
|
|
assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT); |
|
|
@ -324,13 +325,15 @@ describe('Other conditions', function() { |
|
|
|
it('should respond correctly to a bidi stream', function(done) { |
|
|
|
it('should respond correctly to a bidi stream', function(done) { |
|
|
|
var call = misbehavingClient.bidiStream(); |
|
|
|
var call = misbehavingClient.bidiStream(); |
|
|
|
call.on('data', function(data) { |
|
|
|
call.on('data', function(data) { |
|
|
|
assert.fail(data, null, 'Unexpected data', '!='); |
|
|
|
assert.fail(data, null, 'Unexpected data', '==='); |
|
|
|
}); |
|
|
|
}); |
|
|
|
call.on('error', function(err) { |
|
|
|
call.on('error', function(err) { |
|
|
|
assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT); |
|
|
|
assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT); |
|
|
|
done(); |
|
|
|
done(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
call.write(badArg); |
|
|
|
call.write(badArg); |
|
|
|
|
|
|
|
// TODO(mlumish): Remove call.end()
|
|
|
|
|
|
|
|
call.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
describe('Trailing metadata', function() { |
|
|
|
describe('Trailing metadata', function() { |
|
|
|