Fixed tests

This commit is contained in:
Harshil Sharma 2022-11-24 15:00:06 +05:30
parent eb50a5ae95
commit 3feda10b6d
4 changed files with 18 additions and 17 deletions

View file

@ -433,7 +433,7 @@ func TestBoardCategory(t *testing.T) {
ID: "default_category_id", ID: "default_category_id",
Name: "Boards", Name: "Boards",
}, nil) }, nil)
th.Store.EXPECT().GetBoardsForUserAndTeam("user_id", "team_id", false).Return([]*model.Board{}, nil) th.Store.EXPECT().GetMembersForUser("user_id").Return([]*model.BoardMember{}, nil)
th.Store.EXPECT().AddUpdateCategoryBoard("user_id", "default_category_id", "board_id_1").Return(nil) th.Store.EXPECT().AddUpdateCategoryBoard("user_id", "default_category_id", "board_id_1").Return(nil)
th.Store.EXPECT().AddUpdateCategoryBoard("user_id", "default_category_id", "board_id_2").Return(nil) th.Store.EXPECT().AddUpdateCategoryBoard("user_id", "default_category_id", "board_id_2").Return(nil)
th.Store.EXPECT().AddUpdateCategoryBoard("user_id", "default_category_id", "board_id_3").Return(nil) th.Store.EXPECT().AddUpdateCategoryBoard("user_id", "default_category_id", "board_id_3").Return(nil)

View file

@ -21,19 +21,20 @@ func TestGetUserCategoryBoards(t *testing.T) {
Name: "Boards", Name: "Boards",
}, nil) }, nil)
board1 := &model.Board{ th.Store.EXPECT().GetMembersForUser("user_id").Return([]*model.BoardMember{
ID: "board_id_1", {
} BoardID: "board_id_1",
Synthetic: false,
board2 := &model.Board{ },
ID: "board_id_2", {
} BoardID: "board_id_2",
Synthetic: false,
board3 := &model.Board{ },
ID: "board_id_3", {
} BoardID: "board_id_3",
Synthetic: false,
th.Store.EXPECT().GetBoardsForUserAndTeam("user_id", "team_id", false).Return([]*model.Board{board1, board2, board3}, nil) },
}, nil)
th.Store.EXPECT().AddUpdateCategoryBoard("user_id", "boards_category_id", "board_id_1").Return(nil) th.Store.EXPECT().AddUpdateCategoryBoard("user_id", "boards_category_id", "board_id_1").Return(nil)
th.Store.EXPECT().AddUpdateCategoryBoard("user_id", "boards_category_id", "board_id_2").Return(nil) th.Store.EXPECT().AddUpdateCategoryBoard("user_id", "boards_category_id", "board_id_2").Return(nil)
th.Store.EXPECT().AddUpdateCategoryBoard("user_id", "boards_category_id", "board_id_3").Return(nil) th.Store.EXPECT().AddUpdateCategoryBoard("user_id", "boards_category_id", "board_id_3").Return(nil)
@ -56,7 +57,7 @@ func TestGetUserCategoryBoards(t *testing.T) {
Name: "Boards", Name: "Boards",
}, nil) }, nil)
th.Store.EXPECT().GetBoardsForUserAndTeam("user_id", "team_id", false).Return([]*model.Board{}, nil) th.Store.EXPECT().GetMembersForUser("user_id").Return([]*model.BoardMember{}, nil)
categoryBoards, err := th.App.GetUserCategoryBoards("user_id", "team_id") categoryBoards, err := th.App.GetUserCategoryBoards("user_id", "team_id")
assert.NoError(t, err) assert.NoError(t, err)

View file

@ -55,7 +55,7 @@ func TestApp_ImportArchive(t *testing.T) {
ID: "boards_category_id", ID: "boards_category_id",
Name: "Boards", Name: "Boards",
}, nil) }, nil)
th.Store.EXPECT().GetBoardsForUserAndTeam("user", "test-team", false).Return([]*model.Board{}, nil) th.Store.EXPECT().GetMembersForUser("user").Return([]*model.BoardMember{}, nil)
th.Store.EXPECT().AddUpdateCategoryBoard("user", "boards_category_id", utils.Anything).Return(nil) th.Store.EXPECT().AddUpdateCategoryBoard("user", "boards_category_id", utils.Anything).Return(nil)
err := th.App.ImportArchive(r, opts) err := th.App.ImportArchive(r, opts)

View file

@ -52,6 +52,7 @@ func TestPrepareOnboardingTour(t *testing.T) {
} }
newType := model.BoardTypePrivate newType := model.BoardTypePrivate
th.Store.EXPECT().PatchBoard("board_id_2", &model.BoardPatch{Type: &newType}, "user_id_1").Return(&privateWelcomeBoard, nil) th.Store.EXPECT().PatchBoard("board_id_2", &model.BoardPatch{Type: &newType}, "user_id_1").Return(&privateWelcomeBoard, nil)
th.Store.EXPECT().GetMembersForUser("user_id_1").Return([]*model.BoardMember{}, nil)
userPreferencesPatch := model.UserPreferencesPatch{ userPreferencesPatch := model.UserPreferencesPatch{
UpdatedFields: map[string]string{ UpdatedFields: map[string]string{
@ -76,7 +77,6 @@ func TestPrepareOnboardingTour(t *testing.T) {
ID: "boards_category", ID: "boards_category",
Name: "Boards", Name: "Boards",
}, nil) }, nil)
th.Store.EXPECT().GetBoardsForUserAndTeam("user_id_1", teamID, false).Return([]*model.Board{}, nil)
th.Store.EXPECT().AddUpdateCategoryBoard("user_id_1", "boards_category_id", "board_id_2").Return(nil) th.Store.EXPECT().AddUpdateCategoryBoard("user_id_1", "boards_category_id", "board_id_2").Return(nil)
teamID, boardID, err := th.App.PrepareOnboardingTour(userID, teamID) teamID, boardID, err := th.App.PrepareOnboardingTour(userID, teamID)