From 6e02dc460ab7ab511366127bbf5e0e7844aaf37c Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Tue, 13 Jan 2026 07:48:23 -0600 Subject: [PATCH] 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%. --- test/towerops_web/controllers/error_html_test.exs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/towerops_web/controllers/error_html_test.exs b/test/towerops_web/controllers/error_html_test.exs index 11567612..1579cd49 100644 --- a/test/towerops_web/controllers/error_html_test.exs +++ b/test/towerops_web/controllers/error_html_test.exs @@ -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