mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-09 20:26:13 +00:00
The HTTP port and on-device paths for the SoundTouch speaker were duplicated across pkg/client (unexported) and pkg/service/constants (under a service-layer prefix). Both spots needed the same values, and the next round of work (group/persistence handling in the CLI) would have created a third — or worse, dragged pkg/service into the CLI's dependency graph just for a port number. pkg/speaker is a no-deps leaf that holds the speaker-protocol constants: HTTPPort, the request paths, and the on-device persistence file locations (now including GroupServiceFileLocation, for the upcoming stereo-pair sync work). The client library, the service, the CLI, and tests can all import it without introducing a layering edge. This commit moves nothing into pkg/speaker that doesn't belong there — the service-specific constants (provider IDs, file names, date stub, etc.) stay in pkg/service/constants. Only the genuinely protocol-level values move. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
26 lines
649 B
Go
26 lines
649 B
Go
package speaker
|
|
|
|
import "testing"
|
|
|
|
// Sanity-check the well-known values — a wrong number here would silently
|
|
// break every transport and is cheap to guard against.
|
|
func TestSpeakerConstants(t *testing.T) {
|
|
if HTTPPort != 8090 {
|
|
t.Errorf("HTTPPort = %d, want 8090", HTTPPort)
|
|
}
|
|
|
|
cases := map[string]string{
|
|
"DeviceInfoPath": DeviceInfoPath,
|
|
"PresetsPath": PresetsPath,
|
|
"RecentsPath": RecentsPath,
|
|
"SourcesFileLocation": SourcesFileLocation,
|
|
"GroupServiceFileLocation": GroupServiceFileLocation,
|
|
}
|
|
|
|
for name, val := range cases {
|
|
if val == "" {
|
|
t.Errorf("%s is empty", name)
|
|
}
|
|
}
|
|
}
|