Commit 48dc011b authored by yangjianbo's avatar yangjianbo
Browse files

test(admin,service): 修复代理质量与计费单测口径

parent b341810e
...@@ -332,8 +332,8 @@ func (s *stubAdminService) CheckProxyQuality(ctx context.Context, id int64) (*se ...@@ -332,8 +332,8 @@ func (s *stubAdminService) CheckProxyQuality(ctx context.Context, id int64) (*se
ProxyID: id, ProxyID: id,
Score: 95, Score: 95,
Grade: "A", Grade: "A",
Summary: "通过 4 项,告警 0 项,失败 0 项,挑战 0 项", Summary: "通过 5 项,告警 0 项,失败 0 项,挑战 0 项",
PassedCount: 4, PassedCount: 5,
WarnCount: 0, WarnCount: 0,
FailedCount: 0, FailedCount: 0,
ChallengeCount: 0, ChallengeCount: 0,
......
...@@ -399,8 +399,8 @@ func TestCalculateCost_SupportsCacheBreakdown(t *testing.T) { ...@@ -399,8 +399,8 @@ func TestCalculateCost_SupportsCacheBreakdown(t *testing.T) {
InputPricePerToken: 3e-6, InputPricePerToken: 3e-6,
OutputPricePerToken: 15e-6, OutputPricePerToken: 15e-6,
SupportsCacheBreakdown: true, SupportsCacheBreakdown: true,
CacheCreation5mPrice: 4.0, // per million tokens CacheCreation5mPrice: 4e-6, // per token
CacheCreation1hPrice: 5.0, // per million tokens CacheCreation1hPrice: 5e-6, // per token
}, },
}, },
} }
...@@ -414,8 +414,8 @@ func TestCalculateCost_SupportsCacheBreakdown(t *testing.T) { ...@@ -414,8 +414,8 @@ func TestCalculateCost_SupportsCacheBreakdown(t *testing.T) {
cost, err := svc.CalculateCost("claude-sonnet-4", tokens, 1.0) cost, err := svc.CalculateCost("claude-sonnet-4", tokens, 1.0)
require.NoError(t, err) require.NoError(t, err)
expected5m := float64(100000) / 1_000_000 * 4.0 expected5m := float64(tokens.CacheCreation5mTokens) * 4e-6
expected1h := float64(50000) / 1_000_000 * 5.0 expected1h := float64(tokens.CacheCreation1hTokens) * 5e-6
require.InDelta(t, expected5m+expected1h, cost.CacheCreationCost, 1e-10) require.InDelta(t, expected5m+expected1h, cost.CacheCreationCost, 1e-10)
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment