aboutsummaryrefslogtreecommitdiff
path: root/internal/i18n/vocab_test.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-03 23:34:22 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-03 23:34:22 +0200
commitda1818a73de736dffd1580137352c32bea81be8c (patch)
tree3f17a87077189fe92641b60fbd124c9287c2dfe5 /internal/i18n/vocab_test.go
parentd45d0b4e4534253d782cc6312d7edda43cca196d (diff)
downloadlectio-da1818a73de736dffd1580137352c32bea81be8c.tar.gz
lectio-da1818a73de736dffd1580137352c32bea81be8c.zip
i18n: rank and colour vocabulary tables
Diffstat (limited to 'internal/i18n/vocab_test.go')
-rw-r--r--internal/i18n/vocab_test.go54
1 files changed, 54 insertions, 0 deletions
diff --git a/internal/i18n/vocab_test.go b/internal/i18n/vocab_test.go
new file mode 100644
index 0000000..73115bb
--- /dev/null
+++ b/internal/i18n/vocab_test.go
@@ -0,0 +1,54 @@
+package i18n
+
+import (
+ "testing"
+
+ "github.com/lukaszkasprzak/lectio/internal/calendar"
+)
+
+// Every rank and colour the calendar can emit must have a word in every shipped
+// language. This is the guard against adding a constant later and silently
+// rendering a raw key like "class-2" in the UI.
+func TestVocabularyCoversEveryConstant(t *testing.T) {
+ ranks := []calendar.Rank{
+ calendar.RankFerial, calendar.RankOptional, calendar.RankMemorial,
+ calendar.RankFeast, calendar.RankSolemnity,
+ calendar.RankClass1, calendar.RankClass2, calendar.RankClass3,
+ calendar.RankClass4, calendar.RankCommemoration,
+ }
+ colours := []calendar.Colour{
+ calendar.White, calendar.Red, calendar.Green,
+ calendar.Violet, calendar.Rose, calendar.Black,
+ }
+ for _, lang := range []string{"en", "pl"} {
+ ui := Get(lang)
+ for _, r := range ranks {
+ if ui.Rank[string(r)] == "" {
+ t.Errorf("%s: no rank word for %q", lang, r)
+ }
+ }
+ for _, c := range colours {
+ if ui.Colour[string(c)] == "" {
+ t.Errorf("%s: no colour word for %q", lang, c)
+ }
+ }
+ }
+}
+
+// The English rank words must not change: lectio's CLI has printed these since
+// before the table existed, and English users' output should be untouched.
+func TestEnglishRankWordingUnchanged(t *testing.T) {
+ want := map[string]string{
+ "solemnity": "solemnity", "feast": "feast", "memorial": "memorial",
+ "optional": "optional memorial", "ferial": "feria",
+ "class-1": "I class", "class-2": "II class",
+ "class-3": "III class", "class-4": "IV class",
+ "commemoration": "commemoration",
+ }
+ ui := Get("en")
+ for k, v := range want {
+ if got := ui.Rank[k]; got != v {
+ t.Errorf("rank[%q] = %q, want %q", k, got, v)
+ }
+ }
+}