Skip to content

Commit

Permalink
fix(calls): add test (#53)
Browse files Browse the repository at this point in the history
* fix(calls): add test

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* fix: lint error

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

---------

Signed-off-by: Ariel Gentile <gentilester@gmail.com>
  • Loading branch information
genaris authored Nov 27, 2024
1 parent 3bae825 commit fc2c592
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions packages/calls/tests/DidCommCallsService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@ describe('Didcomm Calls', () => {
await agent.wallet.delete()
})

describe('Offer message', () => {
test('Should create a valid https://didcomm.org/calls/1.0/call-offer message ', async () => {
const message = didcommCallsService.createOffer({
callType: 'video',
parameters: { param: 'value' },
})

const jsonMessage = JsonTransformer.toJSON(message)

expect(jsonMessage).toEqual(
expect.objectContaining({
'@id': expect.any(String),
'@type': 'https://didcomm.org/calls/1.0/call-offer',
callType: 'video',
parameters: { param: 'value' },
}),
)
})
})
describe('Accept message', () => {
test('Should create a valid https://didcomm.org/calls/1.0/call-accept message ', async () => {
const message = didcommCallsService.createAccept({
Expand All @@ -41,4 +60,22 @@ describe('Didcomm Calls', () => {
)
})
})

describe('Reject message', () => {
test('Should create a valid https://didcomm.org/calls/1.0/call-reject message ', async () => {
const message = didcommCallsService.createReject({
threadId: '5678-5678-5678-5678',
})

const jsonMessage = JsonTransformer.toJSON(message)

expect(jsonMessage).toEqual(
expect.objectContaining({
'@id': expect.any(String),
'@type': 'https://didcomm.org/calls/1.0/call-reject',
'~thread': expect.objectContaining({ thid: '5678-5678-5678-5678' }),
}),
)
})
})
})

0 comments on commit fc2c592

Please sign in to comment.