mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-21 13:38:56 +02:00
03f4717e96
* WIP * Added migrations * Updating store method * WIP * WIP * Updated DND * WIP * WIP * WIP * WIP * WIP * wip * WIP * Adding new DB tool * Used migration functions in new migrations * Unique constraint migration * Unique constraint migration * Added SQLITE migrations * Added SQLITE support in few more migrations * Added SQLITE support in few more migrations * WIP * Used old-fashioned way to add unique constraint * Using oldsqlite method * Using oldsqlite method * Fixed all store and app layer tests * fixed integration tests * test and lint fix * Updated migration for MySQL and Postgres on personal server * Types fix * sqlite fix * fix typo * misc cleanup * added new tests * added new tests * de-duping input for postgres * integration tests, rmeoved uneeded migration * Added some migration tests * Added some migration tests * Fixed a test * completed migration tests * completed migration tests * Removed leftover debug statements Co-authored-by: Mattermost Build <build@mattermost.com>
99 lines
3.8 KiB
Go
99 lines
3.8 KiB
Go
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].BoardMetadata))
|
|
require.Equal(t, board.ID, categoryBoards[0].BoardMetadata[0].BoardID)
|
|
|
|
// 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].BoardMetadata))
|
|
require.Equal(t, board2.ID, categoryBoards[0].BoardMetadata[0].BoardID)
|
|
|
|
// 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].BoardMetadata))
|
|
require.Contains(t, categoryBoards[0].BoardMetadata, model.CategoryBoardMetadata{BoardID: board.ID, Hidden: false})
|
|
require.Contains(t, categoryBoards[0].BoardMetadata, model.CategoryBoardMetadata{BoardID: board2.ID, Hidden: false})
|
|
}
|
|
|
|
func TestHideUnhideBoard(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
|
|
th.CreateBoard("team-id", "O")
|
|
|
|
// the created board should not be hidden
|
|
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].BoardMetadata))
|
|
require.False(t, categoryBoards[0].BoardMetadata[0].Hidden)
|
|
|
|
// now we'll hide the board
|
|
response := th.Client.HideBoard("team-id", categoryBoards[0].ID, categoryBoards[0].BoardMetadata[0].BoardID)
|
|
th.CheckOK(response)
|
|
|
|
// verifying if the board has been marked as hidden
|
|
categoryBoards = th.GetUserCategoryBoards("team-id")
|
|
require.True(t, categoryBoards[0].BoardMetadata[0].Hidden)
|
|
|
|
// trying to hide the already hidden board.This should have no effect
|
|
response = th.Client.HideBoard("team-id", categoryBoards[0].ID, categoryBoards[0].BoardMetadata[0].BoardID)
|
|
th.CheckOK(response)
|
|
categoryBoards = th.GetUserCategoryBoards("team-id")
|
|
require.True(t, categoryBoards[0].BoardMetadata[0].Hidden)
|
|
|
|
// now we'll unhide the board
|
|
response = th.Client.UnhideBoard("team-id", categoryBoards[0].ID, categoryBoards[0].BoardMetadata[0].BoardID)
|
|
th.CheckOK(response)
|
|
|
|
// verifying
|
|
categoryBoards = th.GetUserCategoryBoards("team-id")
|
|
require.False(t, categoryBoards[0].BoardMetadata[0].Hidden)
|
|
|
|
// trying to unhide the already visible board.This should have no effect
|
|
response = th.Client.UnhideBoard("team-id", categoryBoards[0].ID, categoryBoards[0].BoardMetadata[0].BoardID)
|
|
th.CheckOK(response)
|
|
categoryBoards = th.GetUserCategoryBoards("team-id")
|
|
require.False(t, categoryBoards[0].BoardMetadata[0].Hidden)
|
|
}
|