Files
yellowjacket/backend/player/player_test.go
T
logan 7317e093a7 fix(ci): fix golangci-lint version, skip player test in CI, remove standalone frontend build
- Use specific golangci-lint version (v2.5.0) instead of 'v2' which
  the action cannot parse
- Use --build-tags flag (v2 syntax) instead of -tags
- Skip player test in CI: requires Wails runtime context and audio
  device which are unavailable in GitHub Actions
- Remove standalone 'pnpm build' from frontend job since Vite cannot
  resolve Wails path aliases alone; the build-check job validates the
  full build via Wails
2026-02-13 22:18:25 -06:00

50 lines
1.1 KiB
Go

package player
import (
"context"
"log/slog"
"os"
"testing"
)
var testQueue = []string{
"../../test_data/music_library_test/other_music/03 PONPONPON.mp3",
"../../test_data/music_library_test/01 Some Chords.mp3",
"../../test_data/music_library_test/03 anything.mp3",
}
func TestPlayer(t *testing.T) {
// This test requires a Wails runtime context for event registration and
// an audio device for playback. Skip in CI where neither is available.
if os.Getenv("CI") != "" {
t.Skip("skipping: requires Wails runtime context and audio device")
}
t.Logf("Starting test")
p, err := NewPlayer(context.Background(), slog.Default(), nil)
if err != nil {
t.Errorf("could not create player\n%s", err.Error())
t.Failed()
}
p.SetContext(t.Context())
t.Logf("initializing player")
for _, track := range testQueue {
t.Logf("loading file: %s", track)
err = p.LoadFile(track)
if err != nil {
t.Errorf("could not load file\n%s\n%s", track, err.Error())
t.Failed()
}
err = p.Play()
if err != nil {
t.Errorf("could not play file\n%s\n%s", track, err.Error())
t.Failed()
}
}
}