2023-03-08 17:47:09 +00:00
|
|
|
package protocol
|
|
|
|
|
|
|
|
import (
|
2024-09-03 11:39:49 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
|
2023-03-08 17:47:09 +00:00
|
|
|
"github.com/status-im/status-go/protocol/requests"
|
|
|
|
)
|
|
|
|
|
2024-09-03 11:39:49 +00:00
|
|
|
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)
|
|
|
|
}
|