fix_: flaky TestJoinCommunityAsMemberWithMemberAndAdminPermission

`waitOnCommunitiesEvent` must be invoked before action that triggers
the event.

fixes: #4760
This commit is contained in:
Patryk Osmaczko 2024-05-22 19:45:21 +02:00 committed by osmaczko
parent 568e07d2eb
commit 97af3f7e52
1 changed files with 4 additions and 3 deletions

View File

@ -959,14 +959,15 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) TestJoinCommunityAsMemberWit
}, },
}, },
} }
response, err = s.owner.CreateCommunityTokenPermission(&permissionRequestAdmin)
s.Require().NoError(err)
s.Require().Len(response.Communities(), 1)
waitOnCommunityPermissionCreated = waitOnCommunitiesEvent(s.owner, func(sub *communities.Subscription) bool { waitOnCommunityPermissionCreated = waitOnCommunitiesEvent(s.owner, func(sub *communities.Subscription) bool {
return len(sub.Community.TokenPermissions()) == 2 return len(sub.Community.TokenPermissions()) == 2
}) })
response, err = s.owner.CreateCommunityTokenPermission(&permissionRequestAdmin)
s.Require().NoError(err)
s.Require().Len(response.Communities(), 1)
err = <-waitOnCommunityPermissionCreated err = <-waitOnCommunityPermissionCreated
s.Require().NoError(err) s.Require().NoError(err)