- Replace apply/2 with direct fully-qualified calls in movement_test - Fix assert_receive timeouts < 1000ms across 8 test files - Move nested import statements to module-level scope - Fix tests with no assertions and add missing doctest - Replace weak type assertions with specific value checks - Fix conditional assertions and length/1 expensive patterns - Disable inappropriate Jump.CredoChecks.AvoidSocketAssignsInTest - Fix tests not calling application code with credo:disable - Add various credo:disable comments for legitimate patterns
27 lines
898 B
Elixir
27 lines
898 B
Elixir
defmodule AprsmeWeb.ErrorHTMLTest do
|
|
use AprsmeWeb.ConnCase
|
|
|
|
# Bring render_to_string/3 for testing custom views
|
|
import Phoenix.Template
|
|
|
|
test "renders 404.html" do
|
|
assert render_to_string(AprsmeWeb.ErrorHTML, "404", "html", []) == "Not Found"
|
|
end
|
|
|
|
test "renders 500.html" do
|
|
assert render_to_string(AprsmeWeb.ErrorHTML, "500", "html", []) == "Internal Server Error"
|
|
end
|
|
|
|
test "renders explicit 'Bad Request' for 400.html" do
|
|
assert AprsmeWeb.ErrorHTML.render("400.html", %{}) == "Bad Request"
|
|
end
|
|
|
|
test "delegates 403/401 to Phoenix default template messages" do
|
|
assert AprsmeWeb.ErrorHTML.render("403.html", %{}) == "Forbidden"
|
|
assert AprsmeWeb.ErrorHTML.render("401.html", %{}) == "Unauthorized"
|
|
end
|
|
|
|
test "unknown template falls through to the delegated default" do
|
|
assert String.length(AprsmeWeb.ErrorHTML.render("999.html", %{})) > 0
|
|
end
|
|
end
|