返回 DeepSeek-Reasonix
migrate_test.go
根目录 / internal / billing / migrate_test.go
1 package billing
2
3 import "testing"
4
5 func TestMigrateLegacyUsageIdentityOnly(t *testing.T) {
6 q := MigrateLegacyUsage(LegacyUsageRecord{SessionCost: 1.25, SessionCurrency: "USD"})
7 if !q.CostComplete || !q.DisplayComplete || !q.Complete || q.Selected == nil {
8 t.Fatalf("migrated quote = %+v", q)
9 }
10 if len(q.Valuations) != 1 || q.Valuations["USD"].Basis != BasisIdentity {
11 t.Fatalf("migrated valuations = %+v", q.Valuations)
12 }
13 }
14
15 func TestMigrateLegacyWipedZeroDoesNotGuess(t *testing.T) {
16 q := MigrateLegacyUsage(LegacyUsageRecord{SessionCurrency: "CNY"})
17 if q.CostComplete || q.Complete || q.DisplayStatus != DisplayStatusUnavailable || q.IncompleteReason != "legacy_wiped_or_zero" {
18 t.Fatalf("wiped quote = %+v", q)
19 }
20 }
21
21 lines GO