404 and 500 drafts

This commit is contained in:
2026-11-06 15:42:52 +01:00
parent b17f346b25
commit 785e403370
14 changed files with 335 additions and 95 deletions
@@ -263,4 +263,17 @@ defmodule ChesstrainerWeb.PageControllerTest do
"/endgames"
]
end
test "unknown routes render the branded 404 page", %{conn: conn} do
html = conn |> get("/this-page-does-not-exist") |> html_response(404)
document = LazyHTML.from_document(html)
assert LazyHTML.text(LazyHTML.query(document, "title")) == Branding.title("Page not found")
assert LazyHTML.text(LazyHTML.query(document, ".error-code")) == "404"
assert html =~ "The page you were looking for moved"
assert html =~ "Browse puzzles"
assert html =~ ~s(class="site-footer")
assert html =~ "/assets/js/marketing.js"
assert html =~ ~s(name="robots")
end
end