feat: P1 合盘/星座/问答与测测完整设计包及模拟器取证工具
落地 synastry/star/ask API 与 H5 页面,补齐 cece-frontend-re complete-design 证据文档,并加入 Android 模拟器截图抓取脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
package integration_test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFlowSynastryMultiChartsAndInvite(t *testing.T) {
|
||||
r, _ := setupAPI(t)
|
||||
var key string
|
||||
|
||||
env, key := doJSON(t, r, http.MethodPost, "/api/v1/profiles", map[string]any{
|
||||
"relation": "self", "birth_date": "1990-05-12", "display_name": "我",
|
||||
"birth_time": "10:30", "birth_place": "上海",
|
||||
}, key)
|
||||
pa := decodeData[map[string]any](t, env.Data)
|
||||
idA, _ := pa["id"].(string)
|
||||
|
||||
env, key = doJSON(t, r, http.MethodPost, "/api/v1/profiles", map[string]any{
|
||||
"relation": "other", "birth_date": "1992-08-20", "display_name": "TA",
|
||||
"birth_time": "08:00", "birth_place": "北京",
|
||||
}, key)
|
||||
pb := decodeData[map[string]any](t, env.Data)
|
||||
idB, _ := pb["id"].(string)
|
||||
|
||||
env, key = doJSON(t, r, http.MethodPost, "/api/v1/reports/synastry", map[string]any{
|
||||
"profile_id_a": idA, "profile_id_b": idB, "as_of": "2026-08-02",
|
||||
}, key)
|
||||
rep := decodeData[map[string]any](t, env.Data)
|
||||
if rep["type"] != "synastry" {
|
||||
t.Fatalf("type=%v", rep["type"])
|
||||
}
|
||||
sum, _ := rep["summary"].(map[string]any)
|
||||
if sum == nil {
|
||||
t.Fatal("summary nil")
|
||||
}
|
||||
if sum["as_of"] != "2026-08-02" {
|
||||
t.Fatalf("as_of=%v", sum["as_of"])
|
||||
}
|
||||
charts, _ := sum["charts"].(map[string]any)
|
||||
if charts == nil {
|
||||
t.Fatal("charts missing")
|
||||
}
|
||||
for _, k := range []string{
|
||||
"compare", "composite", "davison", "marks_me", "marks_other", "overlay",
|
||||
"composite_progressed", "davison_progressed", "marks_progressed",
|
||||
} {
|
||||
if charts[k] == nil {
|
||||
t.Fatalf("missing charts.%s", k)
|
||||
}
|
||||
}
|
||||
// no deep access → detail stripped
|
||||
if rep["has_deep_access"] == true {
|
||||
t.Fatal("expected no deep access")
|
||||
}
|
||||
if rep["detail"] != nil {
|
||||
t.Fatalf("detail should be stripped, got %#v", rep["detail"])
|
||||
}
|
||||
|
||||
// invite flow: second device accepts
|
||||
env, key = doJSON(t, r, http.MethodPost, "/api/v1/synastry/invites", map[string]any{
|
||||
"profile_id": idA,
|
||||
}, key)
|
||||
inv := decodeData[map[string]any](t, env.Data)
|
||||
token, _ := inv["token"].(string)
|
||||
if token == "" {
|
||||
t.Fatal("empty token")
|
||||
}
|
||||
|
||||
env2, key2 := doJSON(t, r, http.MethodGet, "/api/v1/profiles", nil, "")
|
||||
_ = env2
|
||||
env2, key2 = doJSON(t, r, http.MethodGet, "/api/v1/synastry/invites/"+token, nil, key2)
|
||||
meta := decodeData[map[string]any](t, env2.Data)
|
||||
if meta["host_name"] == nil {
|
||||
t.Fatal("host_name missing")
|
||||
}
|
||||
|
||||
env2, key2 = doJSON(t, r, http.MethodPost, "/api/v1/synastry/invites/"+token+"/accept", map[string]any{
|
||||
"display_name": "好友", "birth_date": "1995-03-03",
|
||||
}, key2)
|
||||
acc := decodeData[map[string]any](t, env2.Data)
|
||||
if acc["type"] != "synastry" {
|
||||
t.Fatalf("accept type=%v", acc["type"])
|
||||
}
|
||||
_ = key
|
||||
_ = key2
|
||||
}
|
||||
Reference in New Issue
Block a user