feat(t52): per-folder 庫章——DirectConfig.libraries 對映+libraryFor()(資料夾名 slug/中文退後備/明列優先,go test 綠);兩支 ingest workflow 的 post_block metadata 補 library(真兇:blocks 沒蓋章=兩資料夾全歸 general);托盤連線時回報庫自動登記
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestLibraryPerFolder(t *testing.T) {
|
||||
cfg := &DirectConfig{Library: "kb"}
|
||||
cases := map[string]string{
|
||||
"/Users/x/Desktop/finance": "finance",
|
||||
"/Users/x/Desktop/HR Docs": "hr_docs",
|
||||
"/Users/x/Desktop/官方總圖": "kb",
|
||||
"/Users/x/Desktop/test 01": "test_01",
|
||||
}
|
||||
for in, want := range cases {
|
||||
if got := cfg.libraryFor(in); got != want {
|
||||
t.Errorf("libraryFor(%q) = %q, want %q", in, got, want)
|
||||
}
|
||||
}
|
||||
cfg.Libraries = map[string]string{"/Users/x/Desktop/官方總圖": "official"}
|
||||
if got := cfg.libraryFor("/Users/x/Desktop/官方總圖"); got != "official" {
|
||||
t.Errorf("明列對映應優先,got %q", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user