Skip to content

Commit

Permalink
fix(connections): set image url in create request (#896)
Browse files Browse the repository at this point in the history
Signed-off-by: Amit-Padmani <[email protected]>
  • Loading branch information
Amit-Padmani authored Jun 21, 2022
1 parent dc12427 commit 8396965
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export class ConnectionService {
autoAcceptConnection: config?.autoAcceptConnection,
outOfBandId: outOfBandRecord.id,
invitationDid,
imageUrl: outOfBandInvitation.imageUrl,
})

const { label, imageUrl, autoAcceptConnection } = config
Expand Down
3 changes: 3 additions & 0 deletions packages/core/tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ export function getMockOutOfBand({
state,
reusable,
reuseConnectionId,
imageUrl,
}: {
label?: string
serviceEndpoint?: string
Expand All @@ -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: [
Expand Down

0 comments on commit 8396965

Please sign in to comment.