Skip to content

Commit

Permalink
test: 💍 Add tests to bump coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
prashantasdeveloper committed Jul 30, 2024
1 parent 469c74b commit 9d8e980
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ describe('ConfidentialTransactionsService', () => {

await expect(() => service.findOne(id)).rejects.toThrowError();

expect(handleSdkErrorSpy).toHaveBeenCalledWith(mockError);
expect(handleSdkErrorSpy).toHaveBeenCalledWith(mockError, {
id: id.toString(),
resource: 'Confidential Transaction',
});
});
});

Expand Down
10 changes: 10 additions & 0 deletions src/transactions/transactions.util.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,14 @@ describe('handleSdkError', () => {
expect(error).toBeInstanceOf(expectedError);
});
});
it('should return AppNotFoundError with resource specific info', () => {
const inputError = new PolymeshError({ code: ErrorCode.DataUnavailable, message: '' });
when(mockIsPolymeshError).calledWith(inputError).mockReturnValue(true);
const error = handleSdkError(inputError, { id: '1', resource: 'Example Resource' });

expect(error).toBeInstanceOf(AppNotFoundError);
expect(error.message).toEqual(
'Not Found: Example Resource was not found: with identifier: "1"'
);
});
});

0 comments on commit 9d8e980

Please sign in to comment.