Add test for ErrorHTML fallback render function

Added test to cover the fallback render/2 function that handles
error codes without custom templates (401, 403, 503, etc.).

This improves ErrorHTML coverage from 0% to 100%.
This commit is contained in:
Graham McIntire 2026-01-13 07:48:23 -06:00
parent 7e5da340d3
commit 6e02dc460a
No known key found for this signature in database

View file

@ -16,4 +16,16 @@ defmodule ToweropsWeb.ErrorHTMLTest do
assert html =~ "500"
assert html =~ "Something went wrong on our end"
end
test "renders fallback status message for unknown templates" do
# Test the fallback render/2 function for error codes without custom templates
result = ToweropsWeb.ErrorHTML.render("503.html", %{})
assert result == "Service Unavailable"
result = ToweropsWeb.ErrorHTML.render("401.html", %{})
assert result == "Unauthorized"
result = ToweropsWeb.ErrorHTML.render("403.html", %{})
assert result == "Forbidden"
end
end