package video import ( "os" "testing" "galo/internal/config" ) func TestDetectUnavailable(t *testing.T) { tc := Detect(config.Video{ FFmpegPath: "definitely-missing-ffmpeg-xyz", FFprobePath: "definitely-missing-ffprobe-xyz", }) if tc.Available() { t.Fatalf("expected unavailable toolchain, got %+v", tc) } } func TestDetectAvailable(t *testing.T) { self, err := os.Executable() if err != nil { t.Fatalf("executable: %v", err) } tc := Detect(config.Video{FFmpegPath: self, FFprobePath: self, TempDir: "/tmp"}) if !tc.Available() { t.Fatalf("expected available toolchain, got %+v", tc) } if tc.FFmpegPath() != self || tc.FFprobePath() != self { t.Fatalf("paths = %q %q", tc.FFmpegPath(), tc.FFprobePath()) } if tc.TempDir() != "/tmp" { t.Fatalf("temp dir = %q", tc.TempDir()) } } func TestNilToolchain(t *testing.T) { var tc *Toolchain if tc.Available() { t.Fatal("nil toolchain must be unavailable") } if tc.FFmpegPath() != "" || tc.FFprobePath() != "" || tc.TempDir() != "" { t.Fatal("nil toolchain accessors must be empty") } }