diff options
Diffstat (limited to 'internal/render/render_test.go')
| -rw-r--r-- | internal/render/render_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/render/render_test.go b/internal/render/render_test.go index 496dc23..e2a26fc 100644 --- a/internal/render/render_test.go +++ b/internal/render/render_test.go @@ -181,6 +181,24 @@ func TestGatherVersesLabelLang(t *testing.T) { // replaced by its en label, the citation kept exactly as scraped, and every // other case (pl, unknown/traditional partID, prefix mismatch) is a safe // no-op that returns heading unchanged. +func TestHeadingWithRef(t *testing.T) { + // Traditional-style: a bare label plus Citation -> reference appended. + trad := liturgy.Section{Heading: "Gospel", Citation: "Luke 16:1-9", PartID: "evangelium"} + if got := HeadingWithRef(trad, "en"); got != "Gospel (Luke 16:1-9)" { + t.Errorf("traditional heading = %q, want %q", got, "Gospel (Luke 16:1-9)") + } + // Modern-style: heading already carries "(...)" -> not doubled; the pl label + // is still localised to en. + modern := liturgy.Section{Heading: "Ewangelia (J 20, 1. 11-18)", Citation: "J 20, 1. 11-18", PartID: "ewangelia"} + if got := HeadingWithRef(modern, "en"); got != "Gospel (J 20, 1. 11-18)" { + t.Errorf("modern heading = %q", got) + } + // No citation -> unchanged. + if got := HeadingWithRef(liturgy.Section{Heading: "Gospel", PartID: "evangelium"}, "en"); got != "Gospel" { + t.Errorf("no-citation heading = %q", got) + } +} + func TestLocalizeHeading(t *testing.T) { cases := []struct { name, heading, partID, lang, want string |
