mirror of https://github.com/grpc/grpc-web.git
Add missing exports from RpcError and add test. (#1166)
This commit is contained in:
parent
53964f3668
commit
1efe741695
|
|
@ -40,9 +40,9 @@ class RpcError extends Error {
|
|||
*/
|
||||
constructor(code, message, metadata = {}) {
|
||||
super(message);
|
||||
/** @type {!StatusCode} */
|
||||
/** @export {!StatusCode} */
|
||||
this.code = code;
|
||||
/** @type {!Metadata} */
|
||||
/** @export {!Metadata} */
|
||||
this.metadata = metadata;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,14 @@ describe('grpc-web export test', function() {
|
|||
assert.equal(typeof grpc.web.GrpcWebClientBase.prototype.serverStreaming, 'function');
|
||||
});
|
||||
|
||||
it('should have grpc StatusCode exported', function() {
|
||||
it('should have RpcError properties exported', function() {
|
||||
const rpcError = new grpc.web.RpcError(/* code= */ 0, 'message');
|
||||
assert.equal(typeof rpcError.code, 'number');
|
||||
assert.equal(typeof rpcError.message, 'string');
|
||||
assert.equal(typeof rpcError.metadata, 'object');
|
||||
});
|
||||
|
||||
it('should have StatusCode exported', function() {
|
||||
assert.deepEqual(grpc.web.StatusCode, {
|
||||
ABORTED: 10,
|
||||
ALREADY_EXISTS: 6,
|
||||
|
|
|
|||
Loading…
Reference in New Issue