mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-20 14:51:55 +01:00
27 lines
450 B
Go
27 lines
450 B
Go
package nostr
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
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)
|
|
}
|
|
}
|