diff --git a/pkg/client/bass_integration_test.go b/pkg/client/bass_integration_test.go index 37d5427..d2f774f 100644 --- a/pkg/client/bass_integration_test.go +++ b/pkg/client/bass_integration_test.go @@ -23,7 +23,7 @@ func TestClient_Bass_Integration(t *testing.T) { } // Parse host:port if provided - finalHost, finalPort := parseBassHostPort(host, 8090) + finalHost, finalPort := parseBassHostPort(host) config := &Config{ Host: finalHost, @@ -165,7 +165,7 @@ func TestClient_Bass_IncrementDecrement_Integration(t *testing.T) { } // Parse host:port if provided - finalHost, finalPort := parseBassHostPort(host, 8090) + finalHost, finalPort := parseBassHostPort(host) config := &Config{ Host: finalHost, @@ -296,7 +296,7 @@ func TestClient_Bass_ErrorHandling_Integration(t *testing.T) { } // Parse host:port if provided - finalHost, finalPort := parseBassHostPort(host, 8090) + finalHost, finalPort := parseBassHostPort(host) config := &Config{ Host: finalHost, @@ -354,7 +354,7 @@ func BenchmarkClient_Bass_Integration(b *testing.B) { } // Parse host:port if provided - finalHost, finalPort := parseBassHostPort(host, 8090) + finalHost, finalPort := parseBassHostPort(host) config := &Config{ Host: finalHost, @@ -424,9 +424,9 @@ func BenchmarkClient_Bass_Integration(b *testing.B) { // parseBassHostPort is a helper function for integration tests // This is a simple version for test use -func parseBassHostPort(hostPort string, defaultPort int) (string, int) { +func parseBassHostPort(hostPort string) (string, int) { if !containsSubstring(hostPort, ":") { - return hostPort, defaultPort + return hostPort, defaultSoundTouchPort } // Simple parsing - in real use, we'd use net.SplitHostPort @@ -448,7 +448,7 @@ func parseBassHostPort(hostPort string, defaultPort int) (string, int) { if len(parts) == 2 { // Try to parse port - port := defaultPort + port := defaultSoundTouchPort portStr := parts[1] portInt := 0 @@ -468,5 +468,5 @@ func parseBassHostPort(hostPort string, defaultPort int) (string, int) { return parts[0], port } - return hostPort, defaultPort + return hostPort, defaultSoundTouchPort } diff --git a/pkg/client/client.go b/pkg/client/client.go index 9d53001..77f7a82 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -12,6 +12,9 @@ import ( "github.com/user_account/bose-soundtouch/pkg/models" ) +// defaultSoundTouchPort is the standard port for SoundTouch devices +const defaultSoundTouchPort = 8090 + // Client represents a SoundTouch API client type Client struct { baseURL string diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index 759bfd4..0f0b958 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -987,7 +987,7 @@ func TestClient_GetName_ServerError(t *testing.T) { } func TestClient_GetCapabilities_ServerError(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusInternalServerError) _, _ = w.Write([]byte("Internal Server Error")) })) @@ -1015,7 +1015,7 @@ func TestClient_GetCapabilities_ServerError(t *testing.T) { } func TestClient_GetPresets_ServerError(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusInternalServerError) _, _ = w.Write([]byte("Internal Server Error")) })) diff --git a/pkg/client/source_selection_integration_test.go b/pkg/client/source_selection_integration_test.go index 8b82fd8..de7b6b5 100644 --- a/pkg/client/source_selection_integration_test.go +++ b/pkg/client/source_selection_integration_test.go @@ -21,7 +21,7 @@ func TestClient_SelectSource_Integration(t *testing.T) { } // Parse host:port if provided - finalHost, finalPort := parseHostPort(host, 8090) + finalHost, finalPort := parseHostPort(host) config := &Config{ Host: finalHost, @@ -142,7 +142,7 @@ func TestClient_SelectSourceFromItem_Integration(t *testing.T) { } // Parse host:port if provided - finalHost, finalPort := parseHostPort(host, 8090) + finalHost, finalPort := parseHostPort(host) config := &Config{ Host: finalHost, @@ -190,7 +190,7 @@ func TestClient_SelectSource_ErrorHandling_Integration(t *testing.T) { } // Parse host:port if provided - finalHost, finalPort := parseHostPort(host, 8090) + finalHost, finalPort := parseHostPort(host) config := &Config{ Host: finalHost, @@ -247,7 +247,7 @@ func TestClient_ConvenienceSourceMethods_Integration(t *testing.T) { } // Parse host:port if provided - finalHost, finalPort := parseHostPort(host, 8090) + finalHost, finalPort := parseHostPort(host) config := &Config{ Host: finalHost, @@ -347,7 +347,7 @@ func BenchmarkClient_SelectSource_Integration(b *testing.B) { } // Parse host:port if provided - finalHost, finalPort := parseHostPort(host, 8090) + finalHost, finalPort := parseHostPort(host) config := &Config{ Host: finalHost, @@ -384,9 +384,9 @@ func BenchmarkClient_SelectSource_Integration(b *testing.B) { // parseHostPort is a helper function for integration tests // This is a simple version for test use -func parseHostPort(hostPort string, defaultPort int) (string, int) { +func parseHostPort(hostPort string) (string, int) { if !containsSubstring(hostPort, ":") { - return hostPort, defaultPort + return hostPort, defaultSoundTouchPort } // Simple parsing - in real use, we'd use net.SplitHostPort @@ -408,7 +408,7 @@ func parseHostPort(hostPort string, defaultPort int) (string, int) { if len(parts) == 2 { // Try to parse port - port := defaultPort + port := defaultSoundTouchPort portStr := parts[1] portInt := 0 @@ -428,5 +428,5 @@ func parseHostPort(hostPort string, defaultPort int) (string, int) { return parts[0], port } - return hostPort, defaultPort + return hostPort, defaultSoundTouchPort }