erigon-pulse/cmd/rpcdaemon/cli/config_test.go

22 lines
548 B
Go
Raw Normal View History

2023-10-29 05:34:03 +00:00
package cli
import (
"net/url"
"testing"
"github.com/stretchr/testify/require"
)
func TestParseSocketUrl(t *testing.T) {
t.Run("sock", func(t *testing.T) {
socketUrl, err := url.Parse("unix:///some/file/path.sock")
require.NoError(t, err)
require.EqualValues(t, "/some/file/path.sock", socketUrl.Host+socketUrl.EscapedPath())
})
t.Run("sock", func(t *testing.T) {
socketUrl, err := url.Parse("tcp://localhost:1234")
require.NoError(t, err)
require.EqualValues(t, "localhost:1234", socketUrl.Host+socketUrl.EscapedPath())
})
}