summaryrefslogtreecommitdiff
path: root/internal/cli/liturgy_test.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-27 20:40:12 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-27 20:40:12 +0200
commit588d9fb64e023d08b3e6105b69c08d3f9ddf6083 (patch)
treec2144823d288c2d8d4e072ebfb3ecc58455fd192 /internal/cli/liturgy_test.go
parent2cf3c82d357663423b7f77ec20cdd03faca209fa (diff)
downloadlectio-588d9fb64e023d08b3e6105b69c08d3f9ddf6083.tar.gz
lectio-588d9fb64e023d08b3e6105b69c08d3f9ddf6083.zip
feat(cli): config-driven reading corpus + surface user corpora
Diffstat (limited to 'internal/cli/liturgy_test.go')
-rw-r--r--internal/cli/liturgy_test.go32
1 files changed, 32 insertions, 0 deletions
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"))