package store import ( "encoding/json" "testing" ) // 回归:空列表必须序列化为 [] 而非 null(前端 .map 白屏根因)。 func TestEmptyListsSerializeAsEmptyArrays(t *testing.T) { s := openTestStore(t) cs, err := s.ListConversations("owner_none", "prj_none") if err != nil { t.Fatalf("ListConversations: %v", err) } if cs == nil { t.Fatal("ListConversations returned nil slice") } if b, _ := json.Marshal(cs); string(b) != "[]" { t.Fatalf("expected [], got %s", b) } ps, _ := s.ListProjects("owner_none") if ps == nil { t.Fatal("ListProjects returned nil slice") } if b, _ := json.Marshal(ps); string(b) != "[]" { t.Fatalf("expected [], got %s", b) } }