Skip to content

Commit

Permalink
new test vector
Browse files Browse the repository at this point in the history
  • Loading branch information
nitro-neal committed Feb 7, 2024
1 parent 3f437dd commit 344a03b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions packages/credentials/tests/presentation-exchange.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { Validated, PresentationDefinitionV2 } from '../src/presentation-ex
import { VerifiableCredential } from '../src/verifiable-credential.js';
import { PresentationExchange } from '../src/presentation-exchange.js';
import PresentationExchangeSelectCredentialsTestVector from '../../../web5-spec/test-vectors/presentation_exchange/select_credentials.json' assert { type: 'json' };
import PresentationExchangeCreatePresentationFromCredentialsTestVector from '../../../web5-spec/test-vectors/presentation_exchange/create_presentation_from_credentials.json' assert { type: 'json' };


class BitcoinCredential {
Expand Down Expand Up @@ -252,6 +253,23 @@ describe('PresentationExchange', () => {
}
});
});

describe('Web5TestVectorsPresentationExchange', () => {
it('create_presentation_from_credentials', async () => {
const vectors = PresentationExchangeCreatePresentationFromCredentialsTestVector.vectors;

for (let i = 0; i < vectors.length; i++) {
const input = vectors[i].input;
const expectedOutput = vectors[i].output.presentationSubmission;

const presentation = PresentationExchange.createPresentationFromCredentials({ vcJwts: input.credentialJwts, presentationDefinition: input.presentationDefinition});

expect(presentation.presentationSubmission.definition_id).to.deep.equals(expectedOutput.definition_id);
expect(presentation.presentationSubmission.descriptor_map).to.deep.equals(expectedOutput.descriptor_map);
// expect(presentation.presentationSubmission).to.deep.equals(expectedOutput);
}
});
});
});

function createPresentationDefinition(): PresentationDefinitionV2 {
Expand Down
2 changes: 1 addition & 1 deletion web5-spec

0 comments on commit 344a03b

Please sign in to comment.