payment quotation v2 + payment orchestration v2 draft
This commit is contained in:
49
api/pkg/discovery/rail_vocab_test.go
Normal file
49
api/pkg/discovery/rail_vocab_test.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package discovery
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNormalizeRailOperations(t *testing.T) {
|
||||
got := NormalizeRailOperations([]string{
|
||||
"send",
|
||||
"payout.crypto",
|
||||
"observe.confirm",
|
||||
"unknown",
|
||||
"EXTERNAL_CREDIT",
|
||||
})
|
||||
|
||||
want := []string{
|
||||
RailOperationSend,
|
||||
RailOperationExternalCredit,
|
||||
RailOperationObserveConfirm,
|
||||
}
|
||||
if len(got) != len(want) {
|
||||
t.Fatalf("unexpected operations count: got=%d want=%d", len(got), len(want))
|
||||
}
|
||||
for i := range want {
|
||||
if got[i] != want[i] {
|
||||
t.Fatalf("unexpected operation[%d]: got=%q want=%q", i, got[i], want[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestExpandRailOperationLegacyAliases(t *testing.T) {
|
||||
got := ExpandRailOperation("payout.fiat")
|
||||
if len(got) != 2 {
|
||||
t.Fatalf("unexpected operations count: got=%d want=2", len(got))
|
||||
}
|
||||
if got[0] != RailOperationExternalCredit {
|
||||
t.Fatalf("unexpected first operation: got=%q want=%q", got[0], RailOperationExternalCredit)
|
||||
}
|
||||
if got[1] != RailOperationSend {
|
||||
t.Fatalf("unexpected second operation: got=%q want=%q", got[1], RailOperationSend)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsKnownRail(t *testing.T) {
|
||||
if !IsKnownRail("crypto") {
|
||||
t.Fatalf("expected crypto rail to be known")
|
||||
}
|
||||
if IsKnownRail("telegram") {
|
||||
t.Fatalf("did not expect telegram rail to be known")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user