Files
aego/app/docstool/site_poster_test.go
sanspie a6822156cd
ci-platforms / windows amd64 smoke (push) Skipped
ci / release (push) Successful in 8m58s
ci-platforms / darwin amd64 smoke (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
ci / checks (push) Successful in 4m46s
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 13m28s
Finish Stage 12 editor fixes and refreshed platformer
2026-11-05 17:36:42 +03:00

32 lines
789 B
Go

package docstool
import (
"os"
"path/filepath"
"testing"
)
func TestDemoPosterPrefersCurrentGameAndFallsBackToShots(t *testing.T) {
root := t.TempDir()
shots := filepath.Join(root, "docs", "shots", "demo.png")
poster := filepath.Join(root, "docs", "demo-poster.png")
if err := os.MkdirAll(filepath.Dir(shots), 0o755); err != nil {
t.Fatal(err)
}
if got := demoPoster(root); got != "" {
t.Fatalf("missing poster: %q", got)
}
if err := os.WriteFile(shots, []byte("historical"), 0o644); err != nil {
t.Fatal(err)
}
if got := demoPoster(root); got != shots {
t.Fatalf("fallback: %q", got)
}
if err := os.WriteFile(poster, []byte("current"), 0o644); err != nil {
t.Fatal(err)
}
if got := demoPoster(root); got != poster {
t.Fatalf("current poster: %q", got)
}
}