fix: flakey test with order of chats

This commit is contained in:
Anthony Laibe 2022-05-13 16:02:38 +02:00 committed by saledjenic
parent 2be7e53a89
commit 997708bc82
1 changed files with 16 additions and 12 deletions

View File

@ -310,10 +310,11 @@ func (s *MessengerCommunitiesSuite) TestJoinCommunity() {
} }
// The chat should be created // The chat should be created
createdChat = response.Chats()[1]
if response.Chats()[0].Name == orgChat.Identity.DisplayName { found := false
createdChat = response.Chats()[0] for _, createdChat := range response.Chats() {
} if orgChat.Identity.DisplayName == createdChat.Name {
found = true
s.Require().Equal(community.IDString(), createdChat.CommunityID) s.Require().Equal(community.IDString(), createdChat.CommunityID)
s.Require().Equal(orgChat.Identity.DisplayName, createdChat.Name) s.Require().Equal(orgChat.Identity.DisplayName, createdChat.Name)
s.Require().Equal(orgChat.Identity.Emoji, createdChat.Emoji) s.Require().Equal(orgChat.Identity.Emoji, createdChat.Emoji)
@ -323,6 +324,9 @@ func (s *MessengerCommunitiesSuite) TestJoinCommunity() {
s.Require().True(createdChat.Active) s.Require().True(createdChat.Active)
s.Require().NotEmpty(createdChat.Timestamp) s.Require().NotEmpty(createdChat.Timestamp)
s.Require().True(strings.HasPrefix(createdChat.ID, community.IDString())) s.Require().True(strings.HasPrefix(createdChat.ID, community.IDString()))
}
}
s.Require().True(found)
// Create another org chat // Create another org chat
orgChat = &protobuf.CommunityChat{ orgChat = &protobuf.CommunityChat{