Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
V-Gira committed Sep 10, 2024
1 parent 9cfff54 commit 9a57dc2
Showing 1 changed file with 42 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,12 @@ describe('ConversationService', () => {
const remoteEpoch = 1;

jest.spyOn(apiClient.api.conversation, 'getMLS1to1Conversation').mockResolvedValueOnce({
qualified_id: mockConversationId,
protocol: ConversationProtocol.MLS,
epoch: remoteEpoch,
group_id: mockGroupId,
conversation: {
qualified_id: mockConversationId,
protocol: ConversationProtocol.MLS,
epoch: remoteEpoch,
group_id: mockGroupId,
},
} as unknown as MLS1to1Conversation);
jest.spyOn(mlsService, 'isConversationEstablished').mockResolvedValueOnce(true);

Expand All @@ -361,18 +363,22 @@ describe('ConversationService', () => {
const updatedEpoch = 2;

jest.spyOn(apiClient.api.conversation, 'getMLS1to1Conversation').mockResolvedValueOnce({
qualified_id: mockConversationId,
protocol: ConversationProtocol.MLS,
epoch: remoteEpoch,
group_id: mockGroupId,
conversation: {
qualified_id: mockConversationId,
protocol: ConversationProtocol.MLS,
epoch: remoteEpoch,
group_id: mockGroupId,
},
} as unknown as MLS1to1Conversation);

// The 2nd request we make after joining the conversation with external commit
jest.spyOn(apiClient.api.conversation, 'getMLS1to1Conversation').mockResolvedValueOnce({
qualified_id: mockConversationId,
protocol: ConversationProtocol.MLS,
epoch: updatedEpoch,
group_id: mockGroupId,
conversation: {
qualified_id: mockConversationId,
protocol: ConversationProtocol.MLS,
epoch: updatedEpoch,
group_id: mockGroupId,
},
} as unknown as MLS1to1Conversation);

jest.spyOn(mlsService, 'isConversationEstablished').mockResolvedValueOnce(false);
Expand Down Expand Up @@ -402,18 +408,22 @@ describe('ConversationService', () => {
const updatedEpoch = 1;

jest.spyOn(apiClient.api.conversation, 'getMLS1to1Conversation').mockResolvedValueOnce({
qualified_id: mockConversationId,
protocol: ConversationProtocol.MLS,
epoch: remoteEpoch,
group_id: mockGroupId,
conversation: {
qualified_id: mockConversationId,
protocol: ConversationProtocol.MLS,
epoch: remoteEpoch,
group_id: mockGroupId,
},
} as unknown as MLS1to1Conversation);

// The 2nd request we make after successfully registering a group
jest.spyOn(apiClient.api.conversation, 'getMLS1to1Conversation').mockResolvedValueOnce({
qualified_id: mockConversationId,
protocol: ConversationProtocol.MLS,
epoch: updatedEpoch,
group_id: mockGroupId,
conversation: {
qualified_id: mockConversationId,
protocol: ConversationProtocol.MLS,
epoch: updatedEpoch,
group_id: mockGroupId,
},
} as unknown as MLS1to1Conversation);

jest.spyOn(mlsService, 'wipeConversation');
Expand Down Expand Up @@ -444,18 +454,22 @@ describe('ConversationService', () => {
const updatedEpoch = 1;

jest.spyOn(apiClient.api.conversation, 'getMLS1to1Conversation').mockResolvedValueOnce({
qualified_id: mockConversationId,
protocol: ConversationProtocol.MLS,
epoch: remoteEpoch,
group_id: mockGroupId,
conversation: {
qualified_id: mockConversationId,
protocol: ConversationProtocol.MLS,
epoch: remoteEpoch,
group_id: mockGroupId,
},
} as unknown as MLS1to1Conversation);

// The 2nd request we make when retrying to register the conversation
jest.spyOn(apiClient.api.conversation, 'getMLS1to1Conversation').mockResolvedValueOnce({
qualified_id: mockConversationId,
protocol: ConversationProtocol.MLS,
epoch: remoteEpoch,
group_id: mockGroupId,
conversation: {
qualified_id: mockConversationId,
protocol: ConversationProtocol.MLS,
epoch: remoteEpoch,
group_id: mockGroupId,
},
} as unknown as MLS1to1Conversation);

// The 3rd request we make after successfully registering a group
Expand Down

0 comments on commit 9a57dc2

Please sign in to comment.