From fb3fdc69fad0f374c419559d99d75ba8c81aa632 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 27 Jul 2026 13:21:04 +0200 Subject: feat(cli): --liturgy uses the config 'use' layer stack (custom calendars take effect) --- internal/cli/liturgy_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'internal/cli/liturgy_test.go') diff --git a/internal/cli/liturgy_test.go b/internal/cli/liturgy_test.go index c3ab0b4..c713703 100644 --- a/internal/cli/liturgy_test.go +++ b/internal/cli/liturgy_test.go @@ -2,6 +2,7 @@ package cli import ( "bytes" + "os" "path/filepath" "strings" "testing" @@ -31,3 +32,25 @@ func TestRunLiturgy(t *testing.T) { t.Errorf("proper reading not shown:\n%s", out) } } + +func TestRunLiturgyUserLayer(t *testing.T) { + dir := t.TempDir() + t.Setenv("LECTIO_CONFIG", filepath.Join(dir, "config.ini")) + // a local layer adds a solemnity on 2025-08-11 (an ordinary Monday), and use it. + os.MkdirAll(filepath.Join(dir, "calendars"), 0o755) + os.WriteFile(filepath.Join(dir, "calendars", "local.ini"), + []byte("[layer]\nid = local\ntype = particular\n\n[patron]\ndate = 08-11\nrank = solemnity\nclass = saint\ncolour = red\nname.en = Local Patron\n"), 0o644) + os.WriteFile(filepath.Join(dir, "config.ini"), []byte("use = local\n"), 0o644) + + cfg, err := config.Load() + if err != nil { + t.Fatal(err) + } + var buf bytes.Buffer + if code := runLiturgy(cfg, "2025-08-11", &buf, &buf); code != 0 { + t.Fatalf("exit %d", code) + } + if !strings.Contains(buf.String(), "Local Patron") { + t.Fatalf("user layer's solemnity not observed:\n%s", buf.String()) + } +} -- cgit v1.3