This commit is contained in:
truewhile
2026-10-04 11:46:17 +08:00
parent dacfec7492
commit 6656f9c398
13 changed files with 474 additions and 77 deletions
+3 -3
View File
@@ -75,7 +75,7 @@ func TestSearchRespectsSourceScope(t *testing.T) {
}
// 指定单个源:只应搜到该源的结果
books, skipped, err := svc.Search(t.Context(), "书", []string{idByName["源A"]})
books, skipped, err := svc.Search(t.Context(), "书", []string{idByName["源A"]}, 1)
if err != nil {
t.Fatal(err)
}
@@ -87,7 +87,7 @@ func TestSearchRespectsSourceScope(t *testing.T) {
}
// 空范围:默认全部启用书源,两个源都应命中
books, _, err = svc.Search(t.Context(), "书", nil)
books, _, err = svc.Search(t.Context(), "书", nil, 1)
if err != nil {
t.Fatal(err)
}
@@ -96,7 +96,7 @@ func TestSearchRespectsSourceScope(t *testing.T) {
}
// 范围里的源已不存在(删源/换设备)时退回全部启用,而不是搜不到
books, _, err = svc.Search(t.Context(), "书", []string{"not-a-real-source"})
books, _, err = svc.Search(t.Context(), "书", []string{"not-a-real-source"}, 1)
if err != nil {
t.Fatal(err)
}