From a31dea7988998625cf5c8c98483462cc8850fcb1 Mon Sep 17 00:00:00 2001 From: Patryk Osmaczko Date: Mon, 21 Aug 2023 09:20:25 +0200 Subject: [PATCH] fix: improve stability of `TestReevaluateMemberAdminRoleInClosedCommunity` --- ...nities_messenger_token_permissions_test.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/protocol/communities_messenger_token_permissions_test.go b/protocol/communities_messenger_token_permissions_test.go index 52f2e8f86..81fb9b169 100644 --- a/protocol/communities_messenger_token_permissions_test.go +++ b/protocol/communities_messenger_token_permissions_test.go @@ -1092,23 +1092,22 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) testReevaluateMemberPrivileg }, } - response, err = s.owner.CreateCommunityTokenPermission(createTokenMemberPermission) - s.Require().NoError(err) - s.Require().NotNil(response) - s.Require().Len(response.Communities(), 1) - s.Require().True(response.Communities()[0].HasTokenPermissions()) - waitOnCommunityPermissionCreated := waitOnCommunitiesEvent(s.owner, func(sub *communities.Subscription) bool { return len(sub.Community.TokenPermissions()) == 2 }) + response, err = s.owner.CreateCommunityTokenPermission(createTokenMemberPermission) + s.Require().NoError(err) + s.Require().NotNil(response) + s.Require().Len(response.Communities(), 1) + + community = response.Communities()[0] + s.Require().True(community.HasTokenPermissions()) + s.Require().Len(community.TokenPermissions(), 2) + err = <-waitOnCommunityPermissionCreated s.Require().NoError(err) - community, err = s.owner.communitiesManager.GetByID(community.ID()) - s.Require().NoError(err) - s.Require().Len(community.TokenPermissions(), 2) - s.advertiseCommunityTo(community, s.alice) var tokenPermission *protobuf.CommunityTokenPermission