mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-09-24 16:05:44 +08:00
fix: test
This commit is contained in:
@@ -1377,7 +1377,7 @@ func TestComputeTokenBreakdown_ExplicitZeroImagePrice_NoFallback(t *testing.T) {
|
||||
OutputTokens: 200,
|
||||
ImageOutputTokens: 50,
|
||||
}
|
||||
bd := svc.computeTokenBreakdown(pricing, tokens, 1.0, 0, false, "", false)
|
||||
bd := svc.computeTokenBreakdown(pricing, tokens, 1.0, "", false)
|
||||
|
||||
// ImageOutputTokens should NOT fall back to outputPrice
|
||||
require.Equal(t, 0.0, bd.ImageOutputCost)
|
||||
@@ -1399,7 +1399,7 @@ func TestComputeTokenBreakdown_NonExplicitZeroImagePrice_FallsBackToOutput(t *te
|
||||
OutputTokens: 200,
|
||||
ImageOutputTokens: 50,
|
||||
}
|
||||
bd := svc.computeTokenBreakdown(pricing, tokens, 1.0, 0, false, "", false)
|
||||
bd := svc.computeTokenBreakdown(pricing, tokens, 1.0, "", false)
|
||||
|
||||
// Should fall back to outputPrice since not explicit
|
||||
require.InDelta(t, 50*15e-6, bd.ImageOutputCost, 1e-12)
|
||||
|
||||
@@ -29,7 +29,7 @@ func TestCalculateCostUnified_NilResolver_FallsBackToOldPath(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// Should match the old-path result exactly
|
||||
expected, err := svc.calculateCostInternal("claude-sonnet-4", tokens, 1.0, 0, false, "", nil)
|
||||
expected, err := svc.calculateCostInternal("claude-sonnet-4", tokens, 1.0, "", nil)
|
||||
require.NoError(t, err)
|
||||
require.InDelta(t, expected.TotalCost, cost.TotalCost, 1e-10)
|
||||
require.InDelta(t, expected.ActualCost, cost.ActualCost, 1e-10)
|
||||
|
||||
Reference in New Issue
Block a user