From 04159382489ee77d8c60140bab9940ad5d0d5887 Mon Sep 17 00:00:00 2001 From: KKlochko Date: Sat, 3 May 2025 21:41:43 +0300 Subject: [PATCH] Update the tests for the error htmls. --- .../controllers/error_html_test.exs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/decentralised_book_index_web/controllers/error_html_test.exs b/test/decentralised_book_index_web/controllers/error_html_test.exs index eefc34e..821d944 100644 --- a/test/decentralised_book_index_web/controllers/error_html_test.exs +++ b/test/decentralised_book_index_web/controllers/error_html_test.exs @@ -5,11 +5,18 @@ defmodule DecentralisedBookIndexWeb.ErrorHTMLTest do import Phoenix.Template test "renders 404.html" do - assert render_to_string(DecentralisedBookIndexWeb.ErrorHTML, "404", "html", []) == "Not Found" + html = render_to_string(DecentralisedBookIndexWeb.ErrorHTML, "404", "html", []) + assert html =~ "404" + assert html =~ "Something's missing." + assert html =~ "Sorry, we can't find that page." + assert html =~ "Go to books" end test "renders 500.html" do - assert render_to_string(DecentralisedBookIndexWeb.ErrorHTML, "500", "html", []) == - "Internal Server Error" + html = render_to_string(DecentralisedBookIndexWeb.ErrorHTML, "500", "html", []) + assert html =~ "500" + assert html =~ "Something's went wrong." + assert html =~ "Try to refresh the page. Feel free to contact us if the problem persists." + assert html =~ "Go to books" end end