Files
beatglow/player/raudio/detect_test.go
T

28 lines
700 B
Go

package raudio
import (
"io/fs"
"testing"
"testing/fstest"
)
func TestDetect(t *testing.T) {
for _, tt := range []struct {
name string
root fstest.MapFS
want bool
}{
{"installed", fstest.MapFS{"srv/http/data/system/system.conf": {}}, true},
{"missing", fstest.MapFS{}, false},
{"directory", fstest.MapFS{"srv/http/data/system/system.conf": {Mode: fs.ModeDir}}, false},
{"idle handler only", fstest.MapFS{"srv/http/bash/mpdidle.sh": {}}, false},
{"RuneAudio", fstest.MapFS{"srv/http/command/rune_shutdown": {}}, false},
} {
t.Run(tt.name, func(t *testing.T) {
if got := detect(tt.root); got != tt.want {
t.Fatalf("detect() = %v, want %v", got, tt.want)
}
})
}
}