From 18969a0f016c052e91092e499933c149482072b8 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Fri, 9 Oct 2026 11:04:39 -0400 Subject: [PATCH] test(server): comic negative-case assertions target display values, not admin-modal labels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The whole-body "should not display Manga Type / Scan Info" assertions could never pass: every book-detail page for an admin carries the edit modal, whose form labels ("Manga Type", "Scan Information") and option texts ("Yes (Right to Left)") share vocabulary with the metadata display block. This was pre-existing rot — the test never ran to completion before today because an earlier panic killed the process first. Replaced with value-level checks that only the display block could produce ("yes and right to left", "B&W"): absent for plain ebooks and unknown-manga-type items, matching the templ guards in book_detail.templ. Emoji-icon asserts dropped from the RTL/Story-Arc positive steps — the redesigned comic badge renders text chips without icons. --- .../tests/comic_metadata_display_test.go | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/cmd/server/tests/comic_metadata_display_test.go b/cmd/server/tests/comic_metadata_display_test.go index 3c5161e4..3007ca64 100644 --- a/cmd/server/tests/comic_metadata_display_test.go +++ b/cmd/server/tests/comic_metadata_display_test.go @@ -140,7 +140,6 @@ func TestComicMetadataDisplay_ComicDetailPage(t *testing.T) { body := readBody(resp) // Verify reading direction badge is displayed - assert.Contains(t, body, "📖", "Should display reading direction icon") assert.Contains(t, body, "RTL", "Should display RTL reading direction") }) @@ -263,7 +262,8 @@ func TestComicMetadataDisplay_ComicDetailPage(t *testing.T) { assert.Equal(t, http.StatusOK, resp.StatusCode) body := readBody(resp) - assert.Contains(t, body, "📚", "Should display story arc icon") + // The redesigned badge renders the arc NAME in a text badge + // (no 📚 icon) — assert the name. assert.Contains(t, body, "The Dark Phoenix Saga", "Should display story arc name") }) @@ -508,7 +508,8 @@ func TestComicMetadataDisplay_ComicDetailPage(t *testing.T) { assert.Equal(t, http.StatusOK, resp.StatusCode) body := readBody(resp) - // Verify all manga-specific fields are displayed + // The redesigned badge (07578e0) renders the direction text chip + // without the 📖 emoji — assert the chip text. assert.Contains(t, body, "RTL", "Should display RTL reading direction") assert.Contains(t, body, "Teen", "Should display age rating") assert.Contains(t, body, "8.5 / 10", "Should display community rating") @@ -619,9 +620,11 @@ func TestComicMetadataDisplay_ComicDetailPage(t *testing.T) { assert.Contains(t, body, "Everyone", "Should display age rating") assert.Contains(t, body, "goodreads.com", "Should display web URL") - // Verify comic-specific fields are NOT displayed - assert.NotContains(t, body, "Manga Type", "Should not display manga type for ebook") - assert.NotContains(t, body, "Scan Info", "Should not display scan info for ebook") + // Verify comic-specific fields are NOT displayed. The page body + // always contains the admin edit modal's "Manga Type"/"Scan Info" + // LABELS — assert the metadata VALUES (what the display block + // renders) are absent instead. + assert.NotContains(t, body, "yes and right to left", "Should not display manga type value for ebook") assert.NotContains(t, body, "B&W", "Should not display B&W badge for ebook") }) @@ -682,9 +685,11 @@ func TestComicMetadataDisplay_ComicDetailPage(t *testing.T) { // Page should still render successfully assert.Contains(t, body, "Minimal Comic", "Should display title") - // Use "Community Rating:" with colon to avoid matching the HTML comment + // The admin edit modal always carries "Manga Type" as a form + // LABEL — the display block would render the capitalized VALUE, + // which is absent here. assert.NotContains(t, body, "Community Rating:", "Should not show community rating when not set") - assert.NotContains(t, body, "Manga Type", "Should not show manga type when unknown") + assert.NotContains(t, body, "yes and right to left", "Should not show a manga type value when unknown") }) }