lncli: strip prefix from pay_req flag

This commit is contained in:
Tugay Emin
2022-11-15 18:13:29 +02:00
parent f277f89e08
commit 3f2079fa39
5 changed files with 47 additions and 3 deletions

View File

@@ -3,6 +3,8 @@ package main
import (
"testing"
"time"
"github.com/stretchr/testify/require"
)
var now = time.Date(2017, 11, 10, 7, 8, 9, 1234, time.UTC)
@@ -86,3 +88,30 @@ func TestParseTime(t *testing.T) {
}
}
}
var stripPrefixTests = []struct {
in string
expected string
}{
{
"lightning:ln123",
"ln123",
},
{
"lightning: ln123",
"ln123",
},
{
"ln123",
"ln123",
},
}
func TestStripPrefix(t *testing.T) {
t.Parallel()
for _, test := range stripPrefixTests {
actual := stripPrefix(test.in)
require.Equal(t, test.expected, actual)
}
}