diff options
| author | Joe Mou <dev@mou.fo> | 2026-09-10 14:57:44 -0400 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-09-10 14:58:18 -0400 |
| commit | 8d6898a36e2879bc3e1aef95db2a44c10187169e (patch) | |
| tree | 80256ceb71285381e5f7c37e0bd8ab6b8750d4a8 /src | |
| parent | ca0291062362b3036077cb14bd8d13aca1cde62d (diff) | |
Render the error page in the shared page shell
error.eta carried its own copy of the HTML shell, so error pages missed the
viewport meta tag, the build-commit footer, and the link to the original
GitHub page. The renderer already passes githubUrl and buildCommit to every
template, so the layout needs nothing new from app.ts.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JZAT3YzYP85DihSvQbDKB6
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.test.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/app.test.ts b/src/app.test.ts index c028e1b..450c1cc 100644 --- a/src/app.test.ts +++ b/src/app.test.ts @@ -458,3 +458,26 @@ describe("redirects to GitHub", () => { ); }); }); + +describe("error page", () => { + it("should render inside the page shell", () => { + const html = eta.render("error.eta", { + title: "Not Found", + message: "GitHub responded with HTTP 404 Not Found", + buildCommit: "v0-g1234567", + githubUrl: "https://github.com/actions/deploy-pages", + }); + + assert.match(html, /<title>Not Found<\/title>/); + assert.match(html, /GitHub responded with HTTP 404 Not Found/); + assert.match(html, /<footer>Generated by cgithub commit <code>v0-g1234567<\/code>/); + assert.match(html, /href="https:\/\/github.com\/actions\/deploy-pages"/); + }); + + // The title falls back to the message for errors that carry no status text. + it("should title itself with the message when it has no title", () => { + const html = eta.render("error.eta", { message: "Error: boom" }); + + assert.match(html, /<title>Error: boom<\/title>/); + }); +}); |
