ultisuite-backend/internal/ai/cost/policy_test.go
R3D347HR4Y 3978622050
Some checks are pending
CI / Go tests (push) Waiting to run
CI / Integration tests (push) Waiting to run
CI / DB migrations (push) Waiting to run
refactor(ai): update AI gateway and cost management features
- Refactored AI gateway to utilize new cost management structures for usage tracking.
- Replaced deprecated token extraction methods with a unified cost parsing approach.
- Enhanced usage fallback mechanisms and introduced detailed usage metrics in responses.
- Added new metering functionality to record AI usage and costs effectively.
- Updated tests to reflect changes in usage parsing and cost calculations.
- Introduced new API endpoints for retrieving AI usage summaries and pricing information.
2026-06-16 10:46:33 +02:00

32 lines
758 B
Go

package cost
import (
"testing"
)
func TestMergeMostRestrictive(t *testing.T) {
d10 := int64(10_000_000)
d5 := int64(5_000_000)
m100 := int64(100_000_000)
m50 := int64(50_000_000)
merged := mergeMostRestrictive([]policyCandidate{
{daily: &d10, monthly: &m100, warn: 80},
{daily: &d5, monthly: &m50, warn: 70},
})
if merged.daily == nil || *merged.daily != d5 {
t.Fatalf("expected daily 5M, got %v", merged.daily)
}
if merged.monthly == nil || *merged.monthly != m50 {
t.Fatalf("expected monthly 50M, got %v", merged.monthly)
}
if merged.warn != 70 {
t.Fatalf("expected warn 70, got %d", merged.warn)
}
}
func TestMicroEURToEUR(t *testing.T) {
if v := MicroEURToEUR(1_500_000); v != 1.5 {
t.Fatalf("expected 1.5, got %f", v)
}
}