go-nostr/utils_test.go

27 lines
450 B
Go
Raw Permalink Normal View History

2024-07-29 22:37:28 +09:00
package nostr
import (
"testing"
"github.com/stretchr/testify/assert"
2024-07-29 22:37:28 +09:00
)
func TestIsValidRelayURL(t *testing.T) {
tests := []struct {
u string
want bool
}{
{"ws://127.0.0.1", true},
{"ws://localhost", true},
{"wss://localhost", true},
{"wss://relay.nostr.com", true},
{"http://127.0.0.1", false},
{"127.0.0.1", false},
}
for _, test := range tests {
got := IsValidRelayURL(test.u)
assert.Equal(t, test.want, got)
2024-07-29 22:37:28 +09:00
}
}