Read heading and intro from the pages record on /posts and /events

This commit is contained in:
tleininger committed 2026-09-30 21:33:26 +02:00
1 parent 666614a3b2
commit 4fa17429b5
7 files changed
+87 -7

No files matched your search

@@ -255,6 +255,22 @@ public sealed class PocketBaseFixture : IAsyncLifetime
title = "Downloads", body = "# Downloads", location = "header",
order = 5, slug = "downloads", embed = Array.Empty<string>(), @public = true,
});
// Page records for the posts and events lists. Routes /posts and /events are
// served by PostList and EventList, which read these records for their heading
// and intro (title + body) and render the list themselves, just like FaqList.
// The body carries no "# heading": the title already renders as the h1.
await CreateRecordAsync(http, "pages", new
{
title = "Beiträge", body = "Neuigkeiten aus dem Elternbeirat.",
location = "header",
order = 6, slug = "posts", embed = Array.Empty<string>(), @public = true,
});
await CreateRecordAsync(http, "pages", new
{
title = "Termine", body = "Sitzungen und Veranstaltungen auf einen Blick.",
location = "header",
order = 7, slug = "events", embed = Array.Empty<string>(), @public = true,
});
// A plain content page reached only by its slug (not shown in the header),
// so the catch-all "/{slug}" ContentPage route stays covered. It carries a
// valid location because the field is required; footer keeps it low-key.
+18
View File
@@ -140,6 +140,24 @@ public sealed class RouteSmokeTests : IDisposable
html.ShouldContain("Förderverein"); // the page body, rendered from Markdown
}
[Fact]
public async Task Posts_and_events_render_their_page_heading_and_body()
{
// /posts and /events are served by PostList and EventList, which -- like
// FaqList -- read their own "posts"/"events" page record for heading and
// intro instead of hard-coding them. Assert both the title (as the h1) and
// the body text from the fixture records reach the markup.
var client = _factory.CreateClient();
var posts = await client.GetStringAsync(new Uri("/posts", UriKind.Relative));
posts.ShouldContain("Beiträge"); // heading from the page title
posts.ShouldContain("Neuigkeiten aus dem Elternbeirat."); // the page body
var events = await client.GetStringAsync(new Uri("/events", UriKind.Relative));
events.ShouldContain("Termine"); // heading from the page title
events.ShouldContain("Sitzungen und Veranstaltungen auf einen Blick."); // the page body
}
[Fact]
public async Task Health_returns_200_when_PocketBase_is_reachable()
{