From 588d9fb64e023d08b3e6105b69c08d3f9ddf6083 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 27 Jul 2026 20:40:12 +0200 Subject: feat(cli): config-driven reading corpus + surface user corpora --- internal/cli/liturgy_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'internal/cli/liturgy_test.go') diff --git a/internal/cli/liturgy_test.go b/internal/cli/liturgy_test.go index 91e3974..67303f3 100644 --- a/internal/cli/liturgy_test.go +++ b/internal/cli/liturgy_test.go @@ -7,6 +7,7 @@ import ( "strings" "testing" + "github.com/lukaszkasprzak/lectio/internal/bible" "github.com/lukaszkasprzak/lectio/internal/config" ) @@ -55,6 +56,37 @@ func TestRunLiturgyTraditionalComputesEF(t *testing.T) { } } +func TestVernacularVersionResolver(t *testing.T) { + if got := vernacularVersion(config.Config{ReadingVersion: "drb"}); got != "drb" { + t.Fatalf("explicit: %q", got) + } + if got := vernacularVersion(config.Config{UILanguage: "pl"}); got != "vul" { + t.Fatalf("pl should fall back to Latin: %q", got) + } + if got := vernacularVersion(config.Config{UILanguage: "en"}); got != "drb" { + t.Fatalf("en should be drb: %q", got) + } +} + +func TestVersionDisplayNameFallsBackToCorpusMeta(t *testing.T) { + bible.SetUserCorporaDir("../bible/testdata/corpora") + t.Cleanup(func() { bible.SetUserCorporaDir("") }) + + // "good" is a user fixture with no i18n entry; its sidecar Name must + // surface instead of the bare code. + if got := versionDisplayName("en", "good"); got != "Good Test Corpus" { + t.Fatalf("expected sidecar Name fallback, got %q", got) + } + // a known i18n code still uses the localized chrome label. + if got := versionDisplayName("en", "drb"); got == "drb" { + t.Fatalf("expected localized label, got bare code %q", got) + } + // a totally unknown code with no sidecar falls back to the bare code. + if got := versionDisplayName("en", "zzz-nope"); got != "zzz-nope" { + t.Fatalf("expected bare-code fallback, got %q", got) + } +} + func TestRunLiturgyUserLayer(t *testing.T) { dir := t.TempDir() t.Setenv("LECTIO_CONFIG", filepath.Join(dir, "config.ini")) -- cgit v1.3