gostations/internal/player/player_test.go

27 lines
714 B
Go
Raw Normal View History

package player
import (
"testing"
)
func TestIsInstalled(t *testing.T) {
// These should almost always exist in a reasonable env
if !IsInstalled("sh") && !IsInstalled("bash") && !IsInstalled("ls") {
t.Log("warning: no common shell util found; IsInstalled may be too strict in this env")
}
if IsInstalled("definitely-not-a-real-command-xyz123") {
t.Error("nonexistent command reported as installed")
}
}
func TestLegacyPlayer_BadCommand(t *testing.T) {
p := NewLegacy("definitely-not-a-real-command-xyz123")
err := p.Play("http://example.com")
if err != nil {
// Current legacy impl swallows and prints; we accept nil or err
t.Logf("play bad cmd returned err (ok): %v", err)
}
_ = p.Stop()
}