Skip to content

Commit

Permalink
feat(rest): added support for custom label and custom imageUrl (#71)
Browse files Browse the repository at this point in the history
Signed-off-by: janrtvld <jan@animo.id>
  • Loading branch information
janrtvld committed Nov 5, 2021
1 parent 5f9b1ae commit 686bddd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"typedi": "^0.10.0"
},
"devDependencies": {
"@aries-framework/core": "0.1.0-alpha.291",
"@aries-framework/node": "0.1.0-alpha.291",
"@aries-framework/core": "0.1.0-alpha.301",
"@aries-framework/node": "0.1.0-alpha.301",
"@types/express": "^4.17.13",
"@types/jest": "^27.0.1",
"@types/node": "^16.6.2",
Expand All @@ -55,6 +55,6 @@
"typescript": "^4.4.2"
},
"peerDependencies": {
"@aries-framework/core": "0.1.0-alpha.291"
"@aries-framework/core": "0.1.0-alpha.301"
}
}
8 changes: 8 additions & 0 deletions packages/rest/src/schemas/InvitationConfigRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@ export class InvitationConfigRequest {
@IsOptional()
@IsString()
public mediatorId?: string

@IsOptional()
@IsString()
public myLabel?: string

@IsOptional()
@IsString()
public myImageUrl?: string
}
16 changes: 16 additions & 0 deletions packages/rest/tests/connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,22 @@ describe('ConnectionController', () => {
expect(response.body.connection.alias).toEqual('test')
expect(response.body.connection.autoAcceptConnection).toEqual(false)
})

test('should accept custom label and imageUrl', async () => {
const spy = jest.spyOn(bobAgent.connections, 'createConnection')

const params = {
myLabel: 'custom-label',
myImageUrl: 'https://example.com/image.png',
}

const response = await request(app).post('/connections/create-invitation').send(params)

expect(response.statusCode).toBe(200)
expect(spy).toBeCalledWith(params)
expect(response.body.invitation.label).toEqual('custom-label')
expect(response.body.invitation.imageUrl).toEqual('https://example.com/image.png')
})
})

describe('receive invitation', () => {
Expand Down

0 comments on commit 686bddd

Please sign in to comment.