@@ -4,7 +4,7 @@ import { Test } from "@nestjs/testing";
44import { INestMicroservice , ServiceUnavailableException } from "@nestjs/common" ;
55
66import { TestService } from "./test-handler" ;
7- import { JSONRPCServer } from "." ;
7+ import { JSONRPCServer , CodedRpcException } from "." ;
88import { JSONRPCClient } from "./client-proxy" ;
99
1010describe ( "json-rpc-e2e" , ( ) => {
@@ -37,27 +37,7 @@ describe("json-rpc-e2e", () => {
3737 . then ( res => expect ( res . result . data ) . toStrictEqual ( { data : "hi" } ) ) ;
3838 } ) ;
3939
40- it ( `should check error object properties from JSONRPCClient call` , ( ) => {
41- const jsonRpcErrorObj = {
42- id : expect . stringMatching ,
43- jsonrpc : "" ,
44- error : {
45- message : "" ,
46- code : 403 ,
47- data : {
48- fromService : "" ,
49- params : { data : "" }
50- }
51- }
52- } ;
53- return service . testError ( { data : "hi" } ) . then ( res => {
54- expect ( res ) . toHaveProperty ( "id" ) ;
55- expect ( res ) . toHaveProperty ( "jsonrpc" ) ;
56- expect ( res ) . toHaveProperty ( "error" ) ;
57- } ) ;
58- } ) ;
59-
60- it ( `should return an error and check error data from JSONRPCClient call` , ( ) => {
40+ it ( `should return an error and check error data from JSONRPCClient call` , async ( ) => {
6141 const errorObj = {
6242 message : "RPC EXCEPTION" ,
6343 code : 403 ,
@@ -66,8 +46,8 @@ describe("json-rpc-e2e", () => {
6646 params : { data : "hi" }
6747 }
6848 } ;
69-
70- return service . testError ( { data : "hi" } ) . then ( res => expect ( res . error ) . toStrictEqual ( errorObj ) ) ;
49+ const resp = service . testError ( { data : "hi" } ) ;
50+ return expect ( resp ) . rejects . toThrowError ( ) ;
7151 } ) ;
7252
7353 afterAll ( async ( ) => {
0 commit comments