From af21fec32c7cf3c15879dba6646a0b5cf19ac583 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 22 Apr 2026 08:23:12 +0300 Subject: Fix gallery PNG copy destination --- internal/comic/comic_test.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'internal/comic/comic_test.go') diff --git a/internal/comic/comic_test.go b/internal/comic/comic_test.go index c99bedd..4d0e019 100644 --- a/internal/comic/comic_test.go +++ b/internal/comic/comic_test.go @@ -210,23 +210,27 @@ func TestCopyGalleryPNGsToComicsGallery(t *testing.T) { t.Parallel() root := t.TempDir() - comicDir := filepath.Join(root, "comics", "my-slug") + comicsRoot := filepath.Join(root, "comics") + comicDir := filepath.Join(comicsRoot, "my-slug") if err := os.MkdirAll(comicDir, 0o755); err != nil { t.Fatal(err) } if err := os.WriteFile(filepath.Join(comicDir, "my-slug_gallery_1.png"), []byte("png1"), 0o644); err != nil { t.Fatal(err) } - if err := copyGalleryPNGsToComicsGallery(root, comicDir); err != nil { + if err := copyGalleryPNGsToComicsGallery(comicsRoot, comicDir); err != nil { t.Fatal(err) } - b, err := os.ReadFile(filepath.Join(root, "comics", "gallery", "my-slug_gallery_1.png")) + b, err := os.ReadFile(filepath.Join(comicsRoot, "gallery", "my-slug_gallery_1.png")) if err != nil { t.Fatal(err) } if string(b) != "png1" { t.Fatalf("copied file = %q", b) } + if _, err := os.Stat(filepath.Join(root, "comics", "comics", "gallery", "my-slug_gallery_1.png")); !os.IsNotExist(err) { + t.Fatalf("nested gallery path exists or stat failed unexpectedly: %v", err) + } } func TestGeneratorGenerateFull(t *testing.T) { @@ -424,6 +428,12 @@ func TestArtistAndRunnerEndToEndWithFakes(t *testing.T) { if _, err := os.Stat(filepath.Join(tmpDir, "comics", "assets", "forced-slug", "forced-slug_story.txt")); err != nil { t.Fatalf("story missing: %v", err) } + if _, err := os.Stat(filepath.Join(tmpDir, "comics", "gallery", "forced-slug_gallery_1.png")); err != nil { + t.Fatalf("gallery image missing: %v", err) + } + if _, err := os.Stat(filepath.Join(tmpDir, "comics", "comics", "gallery", "forced-slug_gallery_1.png")); !os.IsNotExist(err) { + t.Fatalf("nested gallery path exists or stat failed unexpectedly: %v", err) + } } func TestNewRunnerUsesRealisticWeightWhenUltraRealisticUnset(t *testing.T) { -- cgit v1.2.3