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:
parent
7e5da340d3
commit
6e02dc460a
1 changed files with 12 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue