Skip to content

Commit

Permalink
new unit test (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
nitro-neal authored and finn-block committed Mar 19, 2024
1 parent d07ca6b commit ccee93c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/credentials/tests/presentation-exchange.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,34 @@ describe('PresentationExchange', () => {
expect(result).to.deep.equal([{ tag: 'root', status: 'info', message: 'ok' }]);
});

it('should successfully catch an invalid presentation definition', () => {
const invalidPd = {
'id' : '',
'input_descriptors' : [
{
'id' : '7b928839-f0b1-4237-893d-b27124b57952',
'constraints' : {
'fields': [
{
'path': [
'$.vc.type[*]',
'$.type[*]'
],
'filter': {
'type' : 'string',
'pattern' : '.*StreetCred.*'
}
}
]
}
}
]
};

const result:Validated = PresentationExchange.validateDefinition({ presentationDefinition: invalidPd });
expect(result).to.deep.equal([{ tag: 'root.presentation_definition', status: 'error', message: 'id should not be empty' }]);
});

it('should successfully validate a submission', () => {
const presentationResult = PresentationExchange.createPresentationFromCredentials({
vcJwts: [btcCredentialJwt],
Expand Down

0 comments on commit ccee93c

Please sign in to comment.