status-go/protocol/messenger_collapsed_communi...

44 lines
1.1 KiB
Go
Raw Permalink Normal View History

2023-03-08 17:47:09 +00:00
package protocol
import (
"testing"
"github.com/stretchr/testify/suite"
2023-03-08 17:47:09 +00:00
"github.com/status-im/status-go/protocol/requests"
)
func TestMessengerCollapsedCommunityCategoriesSuite(t *testing.T) {
suite.Run(t, new(MessengerCollapsedCommunityCategoriesSuite))
}
2023-03-08 17:47:09 +00:00
type MessengerCollapsedCommunityCategoriesSuite struct {
MessengerBaseTestSuite
}
func (s *MessengerCollapsedCommunityCategoriesSuite) TestUpsertCollapsedCommunityCategories() {
communityID := "community-id"
categoryID := "category-id"
request := &requests.ToggleCollapsedCommunityCategory{
CommunityID: communityID,
CategoryID: categoryID,
Collapsed: true,
}
s.Require().NoError(s.m.ToggleCollapsedCommunityCategory(request))
categories, err := s.m.CollapsedCommunityCategories()
s.Require().NoError(err)
s.Require().Len(categories, 1)
s.Require().Equal(communityID, categories[0].CommunityID)
s.Require().Equal(categoryID, categories[0].CategoryID)
request.Collapsed = false
s.Require().NoError(s.m.ToggleCollapsedCommunityCategory(request))
categories, err = s.m.CollapsedCommunityCategories()
s.Require().NoError(err)
s.Require().Len(categories, 0)
}