fix: 修复 PDD 页面误判与失败回执 (#35)
This commit is contained in:
@@ -435,9 +435,17 @@ func TestSubmitFailure_状态映射(t *testing.T) {
|
||||
|
||||
body := `{"task_version":1,"attempt_id":"a-1","status":"` + tc.reported +
|
||||
`","error":{"code":"PDD_PAGE_TIMEOUT","message":"页面超时"}}`
|
||||
if _, err := SubmitFailure(db, "TASK-A", "client-001", "k", []byte(body)); err != nil {
|
||||
response, err := SubmitFailure(db, "TASK-A", "client-001", "k", []byte(body))
|
||||
if err != nil {
|
||||
t.Fatalf("提交失败结果出错: %v", err)
|
||||
}
|
||||
var receipt map[string]any
|
||||
if err := json.Unmarshal([]byte(response), &receipt); err != nil {
|
||||
t.Fatalf("失败响应不是 JSON: %v", err)
|
||||
}
|
||||
if receipt["result_id"] == "" || receipt["result_id"] == nil {
|
||||
t.Error("失败响应 result_id 不应为空")
|
||||
}
|
||||
if s := taskStatus(t, db, "TASK-A"); s != tc.want {
|
||||
t.Errorf("%s 应映射为 %s,实际 %s", tc.reported, tc.want, s)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user