Skip to content

Commit

Permalink
fix: add vp request to return of initiate exchange
Browse files Browse the repository at this point in the history
  • Loading branch information
JGiter committed Jun 2, 2022
1 parent 0dc14d1 commit ddecbaf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
22 changes: 12 additions & 10 deletions e2e/verifiable-credentials.service.e2e.ts
Expand Up @@ -424,20 +424,22 @@ describe('Verifiable credentials tests', () => {
}
);

const [{ selectResults }] =
await verifiableCredentialsService.initiateExchange({
type: VC_API_EXCHANGE,
url: exchangeUrl,
});
const {
selections: [{ selectResults }],
} = await verifiableCredentialsService.initiateExchange({
type: VC_API_EXCHANGE,
url: exchangeUrl,
});
expect(selectResults.verifiableCredential).toHaveLength(1);
});

test('continueExchange() should return issued credentials', async () => {
const [{ selectResults }] =
await verifiableCredentialsService.initiateExchange({
type: VC_API_EXCHANGE,
url: exchangeUrl,
});
const {
selections: [{ selectResults }],
} = await verifiableCredentialsService.initiateExchange({
type: VC_API_EXCHANGE,
url: exchangeUrl,
});

(axios as jest.Mocked<typeof axios>).put.mockImplementationOnce((url) =>
Promise.resolve({
Expand Down
Expand Up @@ -162,7 +162,7 @@ export abstract class VerifiableCredentialsServiceBase {
(q) => q.type === VpRequestQueryType.presentationDefinition
)?.credentialQuery as VpRequestPresentationDefinitionQuery[];

return Promise.all(
const selections = await Promise.all(
credentialQuery.map(async ({ presentationDefinition }) => {
const selectResults = await this.getCredentialsByDefinition(
presentationDefinition
Expand All @@ -173,6 +173,7 @@ export abstract class VerifiableCredentialsServiceBase {
};
})
);
return { vpRequest, selections };
}

/**
Expand Down

0 comments on commit ddecbaf

Please sign in to comment.