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
+15 -1
View File
@@ -1,4 +1,4 @@
// Route: POST /validate/user (all-failures validation error)
// Route: /validate/user (all-failures validation, JSON and HTML form)
#include "support/Assert.hpp"
using namespace molo::example::test;
@@ -17,5 +17,19 @@ int main() {
check(contains(bad.body, "username"), "username failure listed");
check(contains(bad.body, "email"), "missing email listed");
check(contains(bad.body, "age"), "bad age listed");
auto page = f.client->get("/validate/user");
check(page.status == 200, "form page is 200");
check(contains(page.body, "name=\"username\""), "username input");
auto html = f.client->request(
molo::example::fw::Method::Post, "/validate/user",
"username=ad&email=x&age=200",
{{"Content-Type", "application/x-www-form-urlencoded"},
{"Accept", "text/html"}});
check(html.status == 422, "browser post is 422");
check(contains(html.body, "Please fix 3 field(s)"), "all three listed");
check(contains(html.body, "must be at least 3 characters"), "username text");
check(contains(html.body, "must be between 0 and 150"), "age text");
check(!contains(html.body, "validation_error"), "no raw JSON in the page");
return finish("validate/user");
}