package financeorder import ( "testing" "hyapp-admin-server/internal/model" ) func TestFinanceUSDTAddressesFromConfigsKeepsSupportedValidChainsInBusinessOrder(t *testing.T) { items, err := financeUSDTAddressesFromConfigs([]model.AppConfig{ {Key: "BSC", Value: "0x55d398326f99059fF775485246999027B3197955", UpdatedAtMS: 200}, {Key: "future-chain", Value: "not-exposed", UpdatedAtMS: 300}, {Key: "TRON", Value: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", UpdatedAtMS: 100}, }) if err != nil { t.Fatalf("normalize USDT address configs failed: %v", err) } if len(items) != 2 || items[0].Chain != "TRON" || items[1].Chain != "BSC" { t.Fatalf("USDT addresses must expose only supported chains in business order: %+v", items) } } func TestFinanceUSDTAddressesFromConfigsRejectsMalformedStoredAddress(t *testing.T) { _, err := financeUSDTAddressesFromConfigs([]model.AppConfig{{Key: "TRON", Value: "wrong-app-address"}}) if err == nil { t.Fatal("malformed SQL address must fail closed instead of being copied into a recharge order") } }