fix: 统一商务表格展示并修正筛选和全量排序
This commit is contained in:
@@ -43,6 +43,23 @@ func prepareChannels(t *testing.T) (*gorm.DB, business.ChannelRepo) {
|
||||
func channelTestScope() business.UserScope {
|
||||
return business.UserScope{SelfID: 8, IncludeSelf: true, DescendantPath: "0,7,8"}
|
||||
}
|
||||
|
||||
func TestChannelKeywordMatchesNameAndContactWithinScope(t *testing.T) {
|
||||
db, repo := prepareChannels(t)
|
||||
if err := db.Exec("UPDATE tab_promote SET nickname='同名公会', real_name='负责人甲' WHERE id=100").Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, keyword := range []string{"公会", "负责人甲"} {
|
||||
page, err := repo.List(context.Background(), business.UserScope{SelfID: 9, OnlySelf: true}, business.ChannelFilter{Keyword: keyword})
|
||||
if err != nil || page.Total != 1 || len(page.Rows) != 1 || page.Rows[0].SourceDB != "lx" {
|
||||
t.Fatalf("keyword must not escape the business scope: %q %+v %v", keyword, page, err)
|
||||
}
|
||||
}
|
||||
page, err := repo.List(context.Background(), channelTestScope(), business.ChannelFilter{Keyword: "%"})
|
||||
if err != nil || page.Total != 0 {
|
||||
t.Fatal("keyword wildcards must be treated literally")
|
||||
}
|
||||
}
|
||||
func TestChannelListMatchesBindingsAndLiteralBusinessKeyword(t *testing.T) {
|
||||
db, repo := prepareChannels(t)
|
||||
ctx := context.Background()
|
||||
|
||||
Reference in New Issue
Block a user