fix(test): make TestPrecheck_Unit skip gracefully when player (mpv) is not installed (as in minimal CI runners); prevents os.Exit(1) from failing go test -short for the root package
This commit is contained in:
parent
fefc6b8a5f
commit
66b7f808f7
@ -8,6 +8,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/gmgauthier/gostations/internal/config"
|
||||
playerpkg "github.com/gmgauthier/gostations/internal/player"
|
||||
"github.com/gmgauthier/gostations/internal/radio"
|
||||
ver "github.com/gmgauthier/gostations/internal/version"
|
||||
)
|
||||
@ -82,6 +84,14 @@ func TestPrecheck_Unit(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Log("✓ Fast precheck unit test")
|
||||
|
||||
p := "mpv"
|
||||
if v, err := config.Get("player.command"); err == nil && v != "" {
|
||||
p = v
|
||||
}
|
||||
if !playerpkg.IsInstalled(p) {
|
||||
t.Skipf("%s is either not installed, or not on your $PATH; skipping real precheck() call in unit test (see TestPrecheck_Live)", p)
|
||||
}
|
||||
|
||||
// Simple smoke test — calls the real precheck() in the common "player installed" path
|
||||
// (no mocking of globals — that's not allowed in Go)
|
||||
precheck()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user