Skip to content

Commit f11242a

Browse files
committed
Working addParticipant test
1 parent cfb2feb commit f11242a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tests/utils/addParticipant.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ describe('addParticipant util', () => {
1818

1919

2020
it('it adds participant to conversation', async () => {
21+
let createSpy = jest.fn((options) => { return mockParticipant })
2122

22-
let createSpy = jest.fn((options) => { return options });
23-
let participantsSpy = jest.fn(() => { return {create:createSpy}});
23+
let participantsSpy = { participants: { create: createSpy } } ;
24+
2425
const conversationsSpy = jest.fn((options) => { return participantsSpy });
2526

2627
mockedClient['conversations'] = {
@@ -30,10 +31,8 @@ describe('addParticipant util', () => {
3031

3132
const result = await addParticipant("myConversationSid", mockParticipant );
3233
expect(conversationsSpy).toBeCalledWith("myConversationSid");
33-
expect(participantsSpy).toBeCalled();
3434
expect(createSpy).toBeCalledWith(mockParticipant);
3535
expect(result).not.toBeNull();
36-
3736
})
3837

3938

0 commit comments

Comments
 (0)