Skip to content

Commit d222f73

Browse files
committed
- fix test with recreated CodedRpcException
1 parent 7e230bd commit d222f73

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/index.spec.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,15 @@ describe("json-rpc-e2e", () => {
3838
});
3939

4040
it(`should return an error and check error data from JSONRPCClient call`, async () => {
41-
const errorObj = {
42-
message: "RPC EXCEPTION",
43-
code: 403,
44-
data: {
41+
const expectedCodedException = expect.objectContaining(
42+
new CodedRpcException("RPC EXCEPTION", 403, {
4543
fromService: "Test Service",
4644
params: { data: "hi" }
47-
}
48-
};
45+
})
46+
);
47+
4948
const resp = service.testError({ data: "hi" });
50-
return expect(resp).rejects.toThrowError();
49+
return expect(resp).rejects.toThrowError(expectedCodedException);
5150
});
5251

5352
afterAll(async () => {

0 commit comments

Comments
 (0)