1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-01-23 18:34:02 +02:00

55 lines
1.8 KiB
Go
Raw Normal View History

DND support for category and boards in LHS (#3964) * WIP * WIP * Removed unused webapp util * Added server tests * Lint fix * Updating existing tests * Updating existing tests * Updating existing tests * Fixing existing tests * Fixing existing tests * Fixing existing tests * WIP * Added category sort order migration * Added logic to set new category on top * Implemented api, WS listein logic remining * finished webapp implementation * Added category type and tests * updated tests * Fixed integration test * type fix * WIP * implemented boards DND to other category and in same category * removed seconds from boards name * wip * debugging cy test * Enabled hiding views list while DNDing * Removed some debug logs * Fixed a bug preventing users from collapsing boards category * WIP * Debugging cypress test * CI * debugging cy test * Testing a fix * reverting test fix * Handled personal server * WIP * WIP * Adding support for building with esbuild * Using different index.html templates for esbuild * WIP * WIP * Fixed delete category and rename category * WIP * WIP * Finally, its done. * Adde suppor tot update board-category mapping in bulk * Fixed a bug where create category option didn't show up on default category * Fixed bug where new board was added as last board in Boards category instead of first board * Minor cleanup * WIP * Added support to drab boards onto collapsed categories * Fixed route order from specific to generic * Fix linter * Updated existin server tests * fixed integration tests * Fixed webapp test err * Removed accidental dependencies * Adding new server tests * Finished server tests * added api to client.go * Added API integration test * Fixed existing webapp tests * WIP * WIP * WIP * WIP * WIP * Fixed missing paranthesis * Some cleanup * fixed server lint * noopped down migration * Fixed issue with DND not working great with newly added category * Fixed a test * Fixed a test * Fixed a test * Fixed console error while DNDing * pakg lock restore * Fixed missing react beautiful dnd in package.lock.json * updated snapshots * Fixed webapp test * Review fixes * Added API permission check Co-authored-by: Jesús Espino <jespinog@gmail.com>
2022-11-24 15:31:32 +05:30
package integrationtests
import (
"testing"
"github.com/mattermost/focalboard/server/model"
"github.com/stretchr/testify/require"
)
func TestSidebar(t *testing.T) {
th := SetupTestHelperWithToken(t).Start()
defer th.TearDown()
// we'll create a new board.
// The board should end up in a default "Boards" category
board := th.CreateBoard("team-id", "O")
categoryBoards := th.GetUserCategoryBoards("team-id")
require.Equal(t, 1, len(categoryBoards))
require.Equal(t, "Boards", categoryBoards[0].Name)
require.Equal(t, 1, len(categoryBoards[0].BoardIDs))
require.Equal(t, board.ID, categoryBoards[0].BoardIDs[0])
// create a new category, a new board
// and move that board into the new category
board2 := th.CreateBoard("team-id", "O")
category := th.CreateCategory(model.Category{
Name: "Category 2",
TeamID: "team-id",
UserID: "single-user",
})
th.UpdateCategoryBoard("team-id", category.ID, board2.ID)
categoryBoards = th.GetUserCategoryBoards("team-id")
// now there should be two categories - boards and the one
// we created just now
require.Equal(t, 2, len(categoryBoards))
// the newly created category should be the first one array
// as new categories end up on top in LHS
require.Equal(t, "Category 2", categoryBoards[0].Name)
require.Equal(t, 1, len(categoryBoards[0].BoardIDs))
require.Equal(t, board2.ID, categoryBoards[0].BoardIDs[0])
// now we'll delete the custom category we created, "Category 2"
// and all it's boards should get moved to the Boards category
th.DeleteCategory("team-id", category.ID)
categoryBoards = th.GetUserCategoryBoards("team-id")
require.Equal(t, 1, len(categoryBoards))
require.Equal(t, "Boards", categoryBoards[0].Name)
require.Equal(t, 2, len(categoryBoards[0].BoardIDs))
require.Contains(t, categoryBoards[0].BoardIDs, board.ID)
require.Contains(t, categoryBoards[0].BoardIDs, board2.ID)
}