[MM-25268] Implement prefix/suffix searching on teams and channel page in system console (#14698)
* Implement prefix/suffix search on teams page * Make Channel Page prefix/suffix search as well * address PR comments * add tests * fix styling * take postgres into account * add more api tests * update test * add team store test * write store test for team and channel * fix lint * update description * revert go mod Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
92c98dac3e
Коммит
2c9c58ff50
@@ -1220,18 +1220,74 @@ func TestSearchAllTeamsPaged(t *testing.T) {
|
||||
teams[i] = newTeam
|
||||
}
|
||||
|
||||
foobarTeam, err := th.App.CreateTeam(&model.Team{
|
||||
DisplayName: "FOOBAR",
|
||||
Name: "whatever",
|
||||
Type: model.TEAM_OPEN,
|
||||
Email: th.GenerateTestEmail(),
|
||||
})
|
||||
require.Nil(t, err)
|
||||
|
||||
testCases := []struct {
|
||||
Name string
|
||||
Search *model.TeamSearch
|
||||
ExpectedTeams []string
|
||||
ExpectedTotalCount int64
|
||||
}{
|
||||
{
|
||||
Name: "Get foobar channel",
|
||||
Search: &model.TeamSearch{Term: "oob", Page: model.NewInt(0), PerPage: model.NewInt(100)},
|
||||
ExpectedTeams: []string{foobarTeam.Id},
|
||||
ExpectedTotalCount: 1,
|
||||
},
|
||||
{
|
||||
Name: "Get foobar channel",
|
||||
Search: &model.TeamSearch{Term: "foo", Page: model.NewInt(0), PerPage: model.NewInt(100)},
|
||||
ExpectedTeams: []string{foobarTeam.Id},
|
||||
ExpectedTotalCount: 1,
|
||||
},
|
||||
{
|
||||
Name: "Get foobar channel",
|
||||
Search: &model.TeamSearch{Term: "bar", Page: model.NewInt(0), PerPage: model.NewInt(100)},
|
||||
ExpectedTeams: []string{foobarTeam.Id},
|
||||
ExpectedTotalCount: 1,
|
||||
},
|
||||
{
|
||||
Name: "Get foobar channel",
|
||||
Search: &model.TeamSearch{Term: "what", Page: model.NewInt(0), PerPage: model.NewInt(100)},
|
||||
ExpectedTeams: []string{foobarTeam.Id},
|
||||
ExpectedTotalCount: 1,
|
||||
},
|
||||
{
|
||||
Name: "Get foobar channel",
|
||||
Search: &model.TeamSearch{Term: "ever", Page: model.NewInt(0), PerPage: model.NewInt(100)},
|
||||
ExpectedTeams: []string{foobarTeam.Id},
|
||||
ExpectedTotalCount: 1,
|
||||
},
|
||||
{
|
||||
Name: "Get all teams on one page",
|
||||
Search: &model.TeamSearch{Term: commonRandom, Page: model.NewInt(0), PerPage: model.NewInt(100)},
|
||||
ExpectedTeams: []string{teams[0].Id, teams[1].Id, teams[2].Id},
|
||||
ExpectedTotalCount: 3,
|
||||
},
|
||||
{
|
||||
Name: "Get all teams on one page with partial word",
|
||||
Search: &model.TeamSearch{Term: commonRandom[11:18]},
|
||||
ExpectedTeams: []string{teams[0].Id, teams[1].Id, teams[2].Id},
|
||||
ExpectedTotalCount: 3,
|
||||
},
|
||||
{
|
||||
Name: "Get all teams on one page with term upper cased",
|
||||
Search: &model.TeamSearch{Term: strings.ToUpper(commonRandom)},
|
||||
ExpectedTeams: []string{teams[0].Id, teams[1].Id, teams[2].Id},
|
||||
ExpectedTotalCount: 3,
|
||||
},
|
||||
{
|
||||
Name: "Get all teams on one page with some of term upper and some lower",
|
||||
Search: &model.TeamSearch{Term: commonRandom[0:11] + strings.ToUpper(commonRandom[11:18]+commonRandom[18:])},
|
||||
ExpectedTeams: []string{teams[0].Id, teams[1].Id, teams[2].Id},
|
||||
ExpectedTotalCount: 3,
|
||||
},
|
||||
{
|
||||
Name: "Get 2 teams on the first page",
|
||||
Search: &model.TeamSearch{Term: commonRandom, Page: model.NewInt(0), PerPage: model.NewInt(2)},
|
||||
|
||||
Ссылка в новой задаче
Block a user