From 48dc011b2a1ab037ed075c7f81f233319bda563e Mon Sep 17 00:00:00 2001 From: yangjianbo Date: Thu, 19 Feb 2026 21:39:31 +0800 Subject: [PATCH] =?UTF-8?q?test(admin,service):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BB=A3=E7=90=86=E8=B4=A8=E9=87=8F=E4=B8=8E=E8=AE=A1=E8=B4=B9?= =?UTF-8?q?=E5=8D=95=E6=B5=8B=E5=8F=A3=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/internal/handler/admin/admin_service_stub_test.go | 4 ++-- backend/internal/service/billing_service_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/internal/handler/admin/admin_service_stub_test.go b/backend/internal/handler/admin/admin_service_stub_test.go index e9c9f43c..9f3dcf80 100644 --- a/backend/internal/handler/admin/admin_service_stub_test.go +++ b/backend/internal/handler/admin/admin_service_stub_test.go @@ -332,8 +332,8 @@ func (s *stubAdminService) CheckProxyQuality(ctx context.Context, id int64) (*se ProxyID: id, Score: 95, Grade: "A", - Summary: "通过 4 项,告警 0 项,失败 0 项,挑战 0 项", - PassedCount: 4, + Summary: "通过 5 项,告警 0 项,失败 0 项,挑战 0 项", + PassedCount: 5, WarnCount: 0, FailedCount: 0, ChallengeCount: 0, diff --git a/backend/internal/service/billing_service_test.go b/backend/internal/service/billing_service_test.go index bd173b96..5eb278f6 100644 --- a/backend/internal/service/billing_service_test.go +++ b/backend/internal/service/billing_service_test.go @@ -399,8 +399,8 @@ func TestCalculateCost_SupportsCacheBreakdown(t *testing.T) { InputPricePerToken: 3e-6, OutputPricePerToken: 15e-6, SupportsCacheBreakdown: true, - CacheCreation5mPrice: 4.0, // per million tokens - CacheCreation1hPrice: 5.0, // per million tokens + CacheCreation5mPrice: 4e-6, // per token + CacheCreation1hPrice: 5e-6, // per token }, }, } @@ -414,8 +414,8 @@ func TestCalculateCost_SupportsCacheBreakdown(t *testing.T) { cost, err := svc.CalculateCost("claude-sonnet-4", tokens, 1.0) require.NoError(t, err) - expected5m := float64(100000) / 1_000_000 * 4.0 - expected1h := float64(50000) / 1_000_000 * 5.0 + expected5m := float64(tokens.CacheCreation5mTokens) * 4e-6 + expected1h := float64(tokens.CacheCreation1hTokens) * 5e-6 require.InDelta(t, expected5m+expected1h, cost.CacheCreationCost, 1e-10) }