From 8396965bfb2922bd5606383c12788d9c60968918 Mon Sep 17 00:00:00 2001 From: Amit-Padmani <106090107+Amit-Padmani@users.noreply.github.com> Date: Tue, 21 Jun 2022 22:00:06 +0530 Subject: [PATCH] fix(connections): set image url in create request (#896) Signed-off-by: Amit-Padmani --- .../connections/__tests__/ConnectionService.test.ts | 11 +++++++++++ .../modules/connections/services/ConnectionService.ts | 1 + packages/core/tests/helpers.ts | 3 +++ 3 files changed, 15 insertions(+) diff --git a/packages/core/src/modules/connections/__tests__/ConnectionService.test.ts b/packages/core/src/modules/connections/__tests__/ConnectionService.test.ts index 2ac04cbb98..97ef3fbd3d 100644 --- a/packages/core/src/modules/connections/__tests__/ConnectionService.test.ts +++ b/packages/core/src/modules/connections/__tests__/ConnectionService.test.ts @@ -124,6 +124,17 @@ describe('ConnectionService', () => { expect(message.label).toBe('Custom label') }) + it('returns a connection record containing image url', async () => { + expect.assertions(1) + + const outOfBand = getMockOutOfBand({ state: OutOfBandState.PrepareResponse, imageUrl: connectionImageUrl }) + const config = { label: 'Custom label', routing: myRouting } + + const { connectionRecord } = await connectionService.createRequest(outOfBand, config) + + expect(connectionRecord.imageUrl).toBe(connectionImageUrl) + }) + it('returns a connection request message containing a custom image url', async () => { expect.assertions(1) diff --git a/packages/core/src/modules/connections/services/ConnectionService.ts b/packages/core/src/modules/connections/services/ConnectionService.ts index 9f160f3e18..29f6c703c4 100644 --- a/packages/core/src/modules/connections/services/ConnectionService.ts +++ b/packages/core/src/modules/connections/services/ConnectionService.ts @@ -120,6 +120,7 @@ export class ConnectionService { autoAcceptConnection: config?.autoAcceptConnection, outOfBandId: outOfBandRecord.id, invitationDid, + imageUrl: outOfBandInvitation.imageUrl, }) const { label, imageUrl, autoAcceptConnection } = config diff --git a/packages/core/tests/helpers.ts b/packages/core/tests/helpers.ts index 5bc264c681..1b90d69f32 100644 --- a/packages/core/tests/helpers.ts +++ b/packages/core/tests/helpers.ts @@ -277,6 +277,7 @@ export function getMockOutOfBand({ state, reusable, reuseConnectionId, + imageUrl, }: { label?: string serviceEndpoint?: string @@ -286,9 +287,11 @@ export function getMockOutOfBand({ state?: OutOfBandState reusable?: boolean reuseConnectionId?: string + imageUrl?: string } = {}) { const options = { label: label ?? 'label', + imageUrl: imageUrl ?? undefined, accept: ['didcomm/aip1', 'didcomm/aip2;env=rfc19'], handshakeProtocols: [HandshakeProtocol.DidExchange], services: [