aboutsummaryrefslogtreecommitdiff
path: root/internal/caldata/caldata_test.go
blob: ab7a314198eded6ffe20cebbc6b935fe2c7e0dfe (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
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)
	}
	rc, ok := l.Cels["assumption"]
	if !ok || rc.Fields["rank"] != "solemnity" || rc.Fields["date"] != "08-15" {
		t.Fatalf("assumption = %+v ok=%v", rc, ok)
	}
	// 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"])
		}
	}
}