test(api): align tests with new envelope codes

Update API handler tests to expect numeric `code`, `success` messages, and
new envelope fields (`trace_id`, `details`), matching recent response
envelope changes.
This commit is contained in:
zenfun
2026-01-10 00:39:35 +08:00
parent cb3b7e8230
commit dd32ee817d
7 changed files with 29 additions and 35 deletions

View File

@@ -500,14 +500,10 @@ func TestTrafficChart_MinuteGranularityValidation(t *testing.T) {
t.Fatalf("expected status %d, got %d body=%s", tt.wantStatus, rr.Code, rr.Body.String())
}
var resp map[string]any
env := decodeEnvelope(t, rr, &resp)
env := decodeEnvelope(t, rr, nil)
if env.Message != tt.wantError {
t.Fatalf("expected message=%q, got %q", tt.wantError, env.Message)
}
if errMsg, ok := resp["error"].(string); !ok || errMsg != tt.wantError {
t.Fatalf("expected error=%q, got %v", tt.wantError, resp["error"])
}
})
}
}