Skip to content

Commit

Permalink
chore: add more tests for zoho utils
Browse files Browse the repository at this point in the history
  • Loading branch information
koladilip committed Feb 11, 2025
1 parent 741080a commit 208c375
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/cdk/v2/destinations/zoho/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,25 @@ describe('searchRecordId', () => {
},
expected: { erroneous: true, message: 'No contact is found with record details' },
},
{
name: 'should handle network errors gracefully',
input: {
fields: { email: '[email protected]' },
metadata: { secret: { accessToken: 'token' } },
config: { region: 'US' },
mockError: new Error('Network timeout'),
},
expected: { erroneous: true, message: 'Network timeout' },
},
];

testCases.forEach(({ name, input, expected }) => {
it(name, async () => {
handleHttpRequest.mockResolvedValue(input.mockResponse);
if (input.mockError) {
handleHttpRequest.mockRejectedValue(input.mockError);
} else {
handleHttpRequest.mockResolvedValue(input.mockResponse);
}
const result = await searchRecordId(input.fields, input.metadata, input.config);
expect(result).toEqual(expected);
});
Expand Down

0 comments on commit 208c375

Please sign in to comment.