package discovery import "testing" // TestTheSeedComesFirstAndNothingIsRepeated: the relay the caller knows works is tried first, and // an advertisement that names it again (with a different spelling) does not add a second copy. func TestTheSeedComesFirstAndNothingIsRepeated(t *testing.T) { got := mergeRelays( []string{"wss://relay.one/", "wss://relay.two"}, []string{"wss://relay.two/", "wss://relay.three", "wss://relay.one"}, ) want := []string{"wss://relay.one", "wss://relay.two", "wss://relay.three"} if len(got) != len(want) { t.Fatalf("relays = %v, want %v", got, want) } for i := range want { if got[i] != want[i] { t.Fatalf("relays = %v, want %v", got, want) } } }