Skip to content

Commit

Permalink
IDCOM-1592 Added unit test to ensure validation on referenced schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
William Brooks committed Dec 20, 2021
1 parent e756da6 commit a323f0e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions __test__/creds/VerifiableCredential.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1953,4 +1953,16 @@ describe('Referenced Schemas for Verifiable Credentials', () => {
const filtered = credential.filter(['claim-cvc:Document.dateOfBirth-v1']);
expect(filtered).toBeDefined();
});

test('Validates a schema the contains a reference', async () => {
const type = await Claim.create('claim-cvc:Document.type-v1', 'passport', '1');
const number = await Claim.create('claim-cvc:Document.number-v1', 'FP12345', '1');

const createCredential = VC.create(
'credential-test:IdDocument-v1', '', null, [type, number], '1',
);

expect(createCredential).rejects.toThrow('Missing required claim(s): claim-cvc:Document.name-v1, '
+ 'claim-cvc:Document.issueCountry-v1, claim-cvc:Document.dateOfBirth-v1, claim-cvc:Document.evidences-v1');
});
});

0 comments on commit a323f0e

Please sign in to comment.