fixed rail & operation names
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/tech/sendico/pkg/discovery"
|
||||
"testing"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
@@ -10,14 +11,14 @@ func TestIsGatewayEligible_AllowsMatchingGateway(t *testing.T) {
|
||||
gw := &GatewayInstanceDescriptor{
|
||||
ID: "gw-1",
|
||||
InstanceID: "inst-1",
|
||||
Rail: RailCrypto,
|
||||
Rail: discovery.RailCrypto,
|
||||
Network: "TRON",
|
||||
Currencies: []string{"USDT"},
|
||||
Operations: []RailOperation{RailOperationSend, RailOperationExternalCredit},
|
||||
Operations: []RailOperation{discovery.RailOperationSend, discovery.RailOperationExternalCredit},
|
||||
IsEnabled: true,
|
||||
}
|
||||
|
||||
err := IsGatewayEligible(gw, RailCrypto, "TRON", "USDT", RailOperationSend, GatewayDirectionOut, decimal.RequireFromString("10"))
|
||||
err := IsGatewayEligible(gw, discovery.RailCrypto, "TRON", "USDT", discovery.RailOperationSend, GatewayDirectionOut, decimal.RequireFromString("10"))
|
||||
if err != nil {
|
||||
t.Fatalf("expected gateway to be eligible, got err=%v", err)
|
||||
}
|
||||
@@ -27,21 +28,21 @@ func TestIsGatewayEligible_RejectsNetworkMismatch(t *testing.T) {
|
||||
gw := &GatewayInstanceDescriptor{
|
||||
ID: "gw-1",
|
||||
InstanceID: "inst-1",
|
||||
Rail: RailCrypto,
|
||||
Rail: discovery.RailCrypto,
|
||||
Network: "ETH",
|
||||
Currencies: []string{"USDT"},
|
||||
Operations: []RailOperation{RailOperationSend},
|
||||
Operations: []RailOperation{discovery.RailOperationSend},
|
||||
IsEnabled: true,
|
||||
}
|
||||
|
||||
err := IsGatewayEligible(gw, RailCrypto, "TRON", "USDT", RailOperationSend, GatewayDirectionOut, decimal.RequireFromString("10"))
|
||||
err := IsGatewayEligible(gw, discovery.RailCrypto, "TRON", "USDT", discovery.RailOperationSend, GatewayDirectionOut, decimal.RequireFromString("10"))
|
||||
if err == nil {
|
||||
t.Fatalf("expected network mismatch error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNoEligibleGatewayMessage(t *testing.T) {
|
||||
got := NoEligibleGatewayMessage("tron", "usdt", RailOperationSend, GatewayDirectionOut)
|
||||
got := NoEligibleGatewayMessage("tron", "usdt", discovery.RailOperationSend, GatewayDirectionOut)
|
||||
want := "plan builder: no eligible gateway found for TRON USDT SEND for direction out"
|
||||
if got != want {
|
||||
t.Fatalf("unexpected message: got=%q want=%q", got, want)
|
||||
|
||||
Reference in New Issue
Block a user