erigon-pulse/cmd/rpcdaemon/cli/config_test.go
2023-10-29 12:34:03 +07:00

22 lines
548 B
Go

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())
})
}