File size: 768 Bytes
6778ee0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | defmodule PlausibleWeb.ErrorViewTest do
use PlausibleWeb.ConnCase, async: false
test "renders 500.html", %{conn: conn} do
conn = get(conn, "/test")
layout = Application.get_env(:plausible, PlausibleWeb.Endpoint)[:render_errors][:layout]
error_html =
Phoenix.View.render_to_string(PlausibleWeb.ErrorView, "500.html",
conn: conn,
layout: layout
)
refute error_html =~ "data-domain="
end
test "renders json errors" do
assert Phoenix.View.render_to_string(PlausibleWeb.ErrorView, "500.json", %{}) ==
~s[{"message":"Server error","status":500}]
assert Phoenix.View.render_to_string(PlausibleWeb.ErrorView, "406.json", %{}) ==
~s[{"message":"Not Acceptable","status":406}]
end
end
|