Skip to content

Commit

Permalink
update test logic
Browse files Browse the repository at this point in the history
  • Loading branch information
rnegron committed Feb 19, 2025
1 parent 12de90d commit e107dd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/core/test/tools/mocky.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ const mockRpcGetPresignedPostCall = (key) => {
});
};

const mockRpcFail = (error) => {
const mockRpcFail = (error, status = 400) => {
nock(FAKE_ZAPIER_URL)
.post(RPC_URL_PATH)
.reply(400, (uri, requestBody) => {
.reply(status, (uri, requestBody) => {
const id = JSON.parse(requestBody).id;
return { error, id };
});
Expand Down
8 changes: 4 additions & 4 deletions packages/core/test/tools/rpc-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ describe('rpc client', () => {

it('should handle an explosion', () => {
// mock 3 explosions due to retry
mocky.mockRpcFail('this is an expected explosion');
mocky.mockRpcFail('this is an expected explosion');
mocky.mockRpcFail('this is an expected explosion');
mocky.mockRpcFail('this is an expected explosion', 500);
mocky.mockRpcFail('this is an expected explosion', 500);
mocky.mockRpcFail('this is an expected explosion', 500);

return rpc('explode')
.then(() => {
throw new Error('this should have exploded');
})
.catch((err) => {
err.message.should.eql(
'RPC request failed after 3 attempts: this is an expected explosion',
'RPC request failed after 3 attempts: Unable to reach the RPC server',
);
});
});
Expand Down

0 comments on commit e107dd5

Please sign in to comment.