diff options
Diffstat (limited to 'internal/calfeed/ical_test.go')
| -rw-r--r-- | internal/calfeed/ical_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/calfeed/ical_test.go b/internal/calfeed/ical_test.go index fb7ee9a..215c0e3 100644 --- a/internal/calfeed/ical_test.go +++ b/internal/calfeed/ical_test.go @@ -4,6 +4,8 @@ import ( "strings" "testing" "time" + + "github.com/lukaszkasprzak/lectio/internal/config" ) func TestICalEscapeInjection(t *testing.T) { @@ -19,6 +21,22 @@ func TestICalEscapeInjection(t *testing.T) { } } +// TestICalCarriesSourceOffer pins the AGPL-3.0 ยง13 offer into the VCALENDAR +// header. Someone who subscribes to /calendar.ics in their calendar app sees +// no lectio page at all; the feed is their entire view of the program, so it +// carries the offer. X- properties are inert to clients that ignore them. +func TestICalCarriesSourceOffer(t *testing.T) { + out := string(ICal("new", nil, time.Date(2026, 7, 27, 12, 0, 0, 0, time.UTC))) + for _, want := range []string{ + "X-LECTIO-SOURCE:" + icalEscape(config.SourceURL), + "X-LECTIO-LICENSE:" + icalEscape(config.License), + } { + if !strings.Contains(out, want) { + t.Errorf("missing %q in:\n%s", want, out) + } + } +} + func TestICalStructure(t *testing.T) { days := []DayView{{ Date: "2026-01-06", Season: "time-after-epiphany", Week: 1, Colour: "white", |
