feat(workflow): example stats page with embedded Chart.js, inline form validation errors

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 01:59:27 +02:00
co-authored by Claude Sonnet 5.5
parent 16a0bb0de4
commit 00af65613d
36 changed files with 1274 additions and 138 deletions
+24
View File
@@ -0,0 +1,24 @@
// Route: GET /stats (Chart.js page; library comes from the embedded bundle)
#include "support/Assert.hpp"
using namespace molo::example::test;
int main() {
Fixture f;
auto page = f.client->get("/stats");
check(page.status == 200, "status 200");
check(contains(page.headers.get("Content-Type"), "text/html"), "html");
check(contains(page.body, "<canvas id=\"c-requests\""), "request chart");
check(contains(page.body, "<canvas id=\"c-conns\""), "connection chart");
check(contains(page.body, "/embedded/chart.umd.min.js"), "chart.js linked");
auto lib = f.client->get("/embedded/chart.umd.min.js");
check(lib.status == 200, "chart.js served");
check(lib.headers.get("X-Asset-Source") == "embedded", "from the bundle");
check(contains(lib.body, "Chart.js v"), "real chart.js build embedded");
auto js = f.client->get("/embedded/stats.js");
check(js.status == 200 && contains(js.body, "/stats/data"), "page script");
check(f.client->request(molo::example::fw::Method::Post, "/stats").status ==
405,
"post is 405");
return finish("stats/page");
}