[MM-43151] add test for archived channels search (#19949)
* add test * add channels to test * check for actual channel Co-authored-by: = <=>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7f5eae4062
Коммит
348602cf00
@@ -5587,6 +5587,17 @@ func (s ByChannelDisplayName) Less(i, j int) bool {
|
||||
func testChannelStoreSearchArchivedInTeam(t *testing.T, ss store.Store, s SqlStore) {
|
||||
teamId := model.NewId()
|
||||
userId := model.NewId()
|
||||
o1 := model.Channel{}
|
||||
o1.TeamId = teamId
|
||||
o1.DisplayName = "Channel1"
|
||||
o1.Name = NewTestId()
|
||||
o1.Type = model.ChannelTypeOpen
|
||||
_, nErr := ss.Channel().Save(&o1, -1)
|
||||
require.NoError(t, nErr)
|
||||
o1.DeleteAt = model.GetMillis()
|
||||
o1.UpdateAt = o1.DeleteAt
|
||||
nErr = ss.Channel().Delete(o1.Id, o1.DeleteAt)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
t.Run("empty result", func(t *testing.T) {
|
||||
list, err := ss.Channel().SearchArchivedInTeam(teamId, "term", userId)
|
||||
@@ -5604,6 +5615,14 @@ func testChannelStoreSearchArchivedInTeam(t *testing.T, ss store.Store, s SqlSto
|
||||
require.Error(t, err)
|
||||
require.Nil(t, list)
|
||||
})
|
||||
|
||||
t.Run("find term", func(t *testing.T) {
|
||||
list, err := ss.Channel().SearchArchivedInTeam(teamId, "Channel", userId)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, list)
|
||||
require.Equal(t, len(list), 1)
|
||||
require.Equal(t, "Channel1", list[0].DisplayName)
|
||||
})
|
||||
}
|
||||
|
||||
func testChannelStoreSearchInTeam(t *testing.T, ss store.Store) {
|
||||
|
||||
Ссылка в новой задаче
Block a user