aboutsummaryrefslogtreecommitdiff
path: root/internal/tradlit/parse_test.go
blob: a7344cd25c40efafadeb7099f3f0ddd747fe5a56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package tradlit

import (
	"os"
	"testing"
)

func TestParse(t *testing.T) {
	body, err := os.ReadFile("testdata/2026-07-22.json")
	if err != nil {
		t.Fatal(err)
	}
	secs, err := Parse(body)
	if err != nil {
		t.Fatal(err)
	}
	var gospel, epistle bool
	for _, s := range secs {
		if s.PartID == "evangelium" {
			gospel = true
			if s.Citation != "Luke 7:36-50" {
				t.Errorf("gospel citation = %q", s.Citation)
			}
			if len(s.Paragraphs) == 0 {
				t.Error("gospel has no vernacular text")
			}
		}
		if s.PartID == "lectio" {
			epistle = true
		}
	}
	if !gospel || !epistle {
		t.Errorf("missing parts: gospel=%v epistle=%v", gospel, epistle)
	}
}