feat: new suffix group auto-creates one workspace row

新建分组即自动带一行工作行(双击命名、上传模板/向下插入行/↑/↓/×按钮齐全),
消灭空分组死步骤;集成测试清理只清自建数据的口径下断言按行名定位
This commit is contained in:
lianjianwei2024
2026-10-30 15:26:43 +08:00
parent 2d2bf50d11
commit 4ebf0afc22
2 changed files with 37 additions and 5 deletions

View File

@@ -223,7 +223,16 @@ func TestSuffixAdminIntegration(t *testing.T) {
}
w = authed(http.MethodGet, fmt.Sprintf("/api/v1/suffix-admin/dirs/%d/page", dirID), "")
sfx := getJSON(w)["data"].(map[string]any)["suffixes"].([]any)
if !sfx[0].(map[string]any)["anchor"].(bool) {
cos4 := func() map[string]any {
for _, line := range sfx {
if line.(map[string]any)["name"] == "cos4" {
return line.(map[string]any)
}
}
t.Fatal("找不到 cos4 行")
return nil
}()
if !cos4["anchor"].(bool) {
t.Fatal("锚定后 anchor 应为 true")
}
@@ -251,7 +260,14 @@ func TestSuffixAdminIntegration(t *testing.T) {
}
w = authed(http.MethodGet, "/api/v1/suffix-admin/overview", "")
groups := getJSON(w)["data"].(map[string]any)["groups"].([]any)
files := groups[0].(map[string]any)["suffixes"].([]any)[0].(map[string]any)["files"].([]any)
var files []any
for _, line := range groups[0].(map[string]any)["suffixes"].([]any) {
m := line.(map[string]any)
if m["name"] == "cos4" {
files = m["files"].([]any)
break
}
}
if len(files) != 1 {
t.Fatalf("概览文件数=%d, want 1", len(files))
}