aboutsummaryrefslogtreecommitdiff
path: root/internal/caldata/caldata_test.go
blob: 12aed8c80ab87086113b4e89947a8ab61f698369 (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
package caldata

import (
	"testing"

	"github.com/lukaszkasprzak/lectio/internal/calendar"
)

func TestUniversalLoads(t *testing.T) {
	l := Universal()
	if l.ID != "universal" {
		t.Fatalf("layer id = %q", l.ID)
	}
	// the Assumption (08-15, solemnity) must be present under some slug.
	assumption := false
	for _, rc := range l.Cels {
		if rc.Fields["date"] == "08-15" && rc.Fields["rank"] == "solemnity" {
			assumption = true
		}
	}
	if !assumption {
		t.Fatal("no 08-15 solemnity (Assumption) in the universal calendar")
	}
	// every entry must build into a typed Celebration whose rank parsed.
	for slug, rc := range l.Cels {
		c := calendar.BuildCelebrationForTest(slug, rc)
		if c.Rank == calendar.RankFerial && rc.Fields["rank"] != "" {
			t.Errorf("%s: rank did not parse (%q)", slug, rc.Fields["rank"])
		}
	}
}