From 3feda10b6d075dd9bd82fa85fcd8b8b9560eaa64 Mon Sep 17 00:00:00 2001 From: Harshil Sharma Date: Thu, 24 Nov 2022 15:00:06 +0530 Subject: [PATCH] Fixed tests --- server/app/boards_test.go | 2 +- server/app/category_boards_test.go | 29 +++++++++++++++-------------- server/app/import_test.go | 2 +- server/app/onboarding_test.go | 2 +- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/server/app/boards_test.go b/server/app/boards_test.go index 5ca96fcf4..bac838d05 100644 --- a/server/app/boards_test.go +++ b/server/app/boards_test.go @@ -433,7 +433,7 @@ func TestBoardCategory(t *testing.T) { ID: "default_category_id", Name: "Boards", }, 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_2").Return(nil) th.Store.EXPECT().AddUpdateCategoryBoard("user_id", "default_category_id", "board_id_3").Return(nil) diff --git a/server/app/category_boards_test.go b/server/app/category_boards_test.go index c1f2e9892..626d71086 100644 --- a/server/app/category_boards_test.go +++ b/server/app/category_boards_test.go @@ -21,19 +21,20 @@ func TestGetUserCategoryBoards(t *testing.T) { Name: "Boards", }, nil) - board1 := &model.Board{ - ID: "board_id_1", - } - - board2 := &model.Board{ - ID: "board_id_2", - } - - board3 := &model.Board{ - ID: "board_id_3", - } - - th.Store.EXPECT().GetBoardsForUserAndTeam("user_id", "team_id", false).Return([]*model.Board{board1, board2, board3}, nil) + th.Store.EXPECT().GetMembersForUser("user_id").Return([]*model.BoardMember{ + { + BoardID: "board_id_1", + Synthetic: false, + }, + { + BoardID: "board_id_2", + Synthetic: false, + }, + { + BoardID: "board_id_3", + Synthetic: false, + }, + }, 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_3").Return(nil) @@ -56,7 +57,7 @@ func TestGetUserCategoryBoards(t *testing.T) { Name: "Boards", }, 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") assert.NoError(t, err) diff --git a/server/app/import_test.go b/server/app/import_test.go index ab37e28a8..de256e643 100644 --- a/server/app/import_test.go +++ b/server/app/import_test.go @@ -55,7 +55,7 @@ func TestApp_ImportArchive(t *testing.T) { ID: "boards_category_id", Name: "Boards", }, 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) err := th.App.ImportArchive(r, opts) diff --git a/server/app/onboarding_test.go b/server/app/onboarding_test.go index 5c1321c2a..ed95fa85a 100644 --- a/server/app/onboarding_test.go +++ b/server/app/onboarding_test.go @@ -52,6 +52,7 @@ func TestPrepareOnboardingTour(t *testing.T) { } newType := model.BoardTypePrivate 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{ UpdatedFields: map[string]string{ @@ -76,7 +77,6 @@ func TestPrepareOnboardingTour(t *testing.T) { ID: "boards_category", Name: "Boards", }, 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) teamID, boardID, err := th.App.PrepareOnboardingTour(userID, teamID)