Skip to content

Commit

Permalink
Added test for getErrorReason
Browse files Browse the repository at this point in the history
  • Loading branch information
abdalmajeed-yoti committed Apr 3, 2024
1 parent dae4e96 commit 18b2a5f
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/digital_identity_service/get.share.receipt.result.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@ describe('GetShareReceiptResult', () => {
parentRememberMeId: 'test_parent_remember_me_id',
timestamp: '2003-11-04T12:51:07Z',
error: 'MANDATORY_DOCUMENT_NOT_PROVIDED',
errorReason: {
requirements_not_met_details: [
{
failure_type: 'ID_DOCUMENT_EXTRACTION',
document_type: 'PASSPORT',
document_country_iso_code: 'GBR',
audit_id: 'audit-123',
details: 'something not right',
},
{
failure_type: 'ID_DOCUMENT_AUTHENTICITY',
document_type: 'PASSPORT',
document_country_iso_code: 'GBR',
audit_id: 'audit-456',
details: 'something still not right',
},
],
},
});
getShareReceiptResult = new GetShareReceiptResult(receiptResponse);
});
Expand Down Expand Up @@ -80,6 +98,27 @@ describe('GetShareReceiptResult', () => {
expect(getShareReceiptResult.getError()).toEqual(error);
});
});
describe('#getErrorReason', () => {
it('should return error value', () => {
const errorReason = getShareReceiptResult.getErrorReason();
expect(errorReason.requirementsNotMetDetails).toHaveLength(2);
const [firstDetail, secondDetail] = errorReason.requirementsNotMetDetails;
expect(firstDetail).toEqual(expect.objectContaining({
failureType: 'ID_DOCUMENT_EXTRACTION',
documentType: 'PASSPORT',
documentCountryIsoCode: 'GBR',
auditId: 'audit-123',
details: 'something not right',
}));
expect(secondDetail).toEqual(expect.objectContaining({
failureType: 'ID_DOCUMENT_AUTHENTICITY',
documentType: 'PASSPORT',
documentCountryIsoCode: 'GBR',
auditId: 'audit-456',
details: 'something still not right',
}));
});
});
describe('#getTimestamp', () => {
it('should return timestamp value', () => {
expect(getShareReceiptResult.getTimestamp().toUTCString()).toBe(
Expand Down

0 comments on commit 18b2a5f

Please sign in to comment.