diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-28 15:07:12 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-28 15:07:12 +0200 |
| commit | 310ac404f25b412c5c1ead12247b4eb36e9f0025 (patch) | |
| tree | 6e1dcc5e1f85a483cef7044d341b7c940c1690a8 /internal/web/server_test.go | |
| parent | 44472bbe31475a3c672ae003d928d7caffb4b50a (diff) | |
| parent | c5abf87fa7198c8f245f407774e2326e4b6c9b9c (diff) | |
| download | lectio-310ac404f25b412c5c1ead12247b4eb36e9f0025.tar.gz lectio-310ac404f25b412c5c1ead12247b4eb36e9f0025.zip | |
Merge branch 'engine-precedence-fixes': OF/EF calendar+readings flawlessness pass
Per-day validation vs litcal (OF) and missalemeum (EF) 2005-2050, all defects
fixed and re-validated to zero: OF calendar 0 real errors forward, OF readings
0 unresolvable, EF 0 reading gaps + resumed Sundays correct.
Diffstat (limited to 'internal/web/server_test.go')
| -rw-r--r-- | internal/web/server_test.go | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/internal/web/server_test.go b/internal/web/server_test.go index 57286d5..42de0b5 100644 --- a/internal/web/server_test.go +++ b/internal/web/server_test.go @@ -630,3 +630,52 @@ func TestCalendarPDF(t *testing.T) { t.Errorf("not a pdf (len=%d)", len(b)) } } + +// TestSourceOffer covers the AGPL-3.0 §13 obligation: a user interacting with +// lectio-web over a network must be offered the corresponding source. That is +// a licence term, not a feature, so it is pinned here -- if someone later +// deletes the footer or the route, this fails rather than quietly putting the +// operator out of compliance. +func TestSourceOffer(t *testing.T) { + cfg := config.Default() + cfg.Offline = true // no network; the offer must not depend on readings + srv := NewServer(cfg) + + t.Run("/source names the licence and where to get the code", func(t *testing.T) { + rec := httptest.NewRecorder() + srv.ServeHTTP(rec, httptest.NewRequest("GET", "/source", nil)) + if rec.Code != http.StatusOK { + t.Fatalf("status = %d, want 200", rec.Code) + } + if ct := rec.Header().Get("Content-Type"); !strings.HasPrefix(ct, "text/plain") { + t.Errorf("content-type = %q, want text/plain", ct) + } + body := rec.Body.String() + for _, want := range []string{config.SourceURL, config.License, config.Version} { + if !strings.Contains(body, want) { + t.Errorf("body missing %q:\n%s", want, body) + } + } + }) + + // Every page a user can actually land on carries the link. Fragments + // (htmx partials) are excluded -- they render inside a full page that + // already has it. + for _, path := range []string{ + "/?date=2026-07-22&v=wuj", + "/reader?v=wuj&book=John&chapter=1", + "/settings", + "/bookmarks", + } { + t.Run("footer on "+path, func(t *testing.T) { + rec := httptest.NewRecorder() + srv.ServeHTTP(rec, httptest.NewRequest("GET", path, nil)) + if rec.Code != http.StatusOK { + t.Fatalf("status = %d, want 200", rec.Code) + } + if !strings.Contains(rec.Body.String(), `href="/source"`) { + t.Errorf("page has no source link (AGPL §13):\n%s", rec.Body.String()) + } + }) + } +} |
