diff options
Diffstat (limited to 'internal/cli/liturgy_test.go')
| -rw-r--r-- | internal/cli/liturgy_test.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/internal/cli/liturgy_test.go b/internal/cli/liturgy_test.go new file mode 100644 index 0000000..c3ab0b4 --- /dev/null +++ b/internal/cli/liturgy_test.go @@ -0,0 +1,33 @@ +package cli + +import ( + "bytes" + "path/filepath" + "strings" + "testing" + + "github.com/lukaszkasprzak/lectio/internal/config" +) + +func TestRunLiturgy(t *testing.T) { + dir := t.TempDir() + t.Setenv("LECTIO_CONFIG", filepath.Join(dir, "config.ini")) + cfg, err := config.Load() + if err != nil { + t.Fatal(err) + } + var buf bytes.Buffer + if code := runLiturgy(cfg, "2025-08-15", &buf, &buf); code != 0 { + t.Fatalf("exit code %d", code) + } + out := buf.String() + if !strings.Contains(out, "2025-08-15") { + t.Errorf("missing date:\n%s", out) + } + if !strings.Contains(strings.ToLower(out), "solemnity") || !strings.Contains(out, "Assumption") { + t.Errorf("2025-08-15 should be the Assumption solemnity:\n%s", out) + } + if !strings.Contains(out, "gospel:") { + t.Errorf("proper reading not shown:\n%s", out) + } +} |
