Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
48dc011b
Commit
48dc011b
authored
Feb 19, 2026
by
yangjianbo
Browse files
test(admin,service): 修复代理质量与计费单测口径
parent
b341810e
Changes
2
Hide whitespace changes
Inline
Side-by-side
backend/internal/handler/admin/admin_service_stub_test.go
View file @
48dc011b
...
@@ -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
,
...
...
backend/internal/service/billing_service_test.go
View file @
48dc011b
...
@@ -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
token
s
CacheCreation5mPrice
:
4
e-6
,
// per token
CacheCreation1hPrice
:
5
.0
,
// per
million
token
s
CacheCreation1hPrice
:
5
e-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
)
*
5
e-6
require
.
InDelta
(
t
,
expected5m
+
expected1h
,
cost
.
CacheCreationCost
,
1e-10
)
require
.
InDelta
(
t
,
expected5m
+
expected1h
,
cost
.
CacheCreationCost
,
1e-10
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment