towerops/test/towerops_web/controllers/page_controller_test.exs
Graham McIntire 3276a1cd8c
fix user session controller test
Update email input ID assertion to match actual template implementation
2026-02-03 13:42:24 -06:00

57 lines
1.5 KiB
Elixir

defmodule ToweropsWeb.PageControllerTest do
use ToweropsWeb.ConnCase
import Towerops.AccountsFixtures
test "GET / renders marketing page when not authenticated", %{conn: conn} do
conn = get(conn, ~p"/")
assert html_response(conn, 200) =~ "Network monitoring"
assert html_response(conn, 200) =~ "made simple"
end
test "GET / redirects to organizations when authenticated", %{conn: conn} do
user = user_fixture()
conn = log_in_user(conn, user)
conn = get(conn, ~p"/")
assert redirected_to(conn) == ~p"/orgs"
end
test "GET /privacy renders privacy policy page", %{conn: conn} do
conn = get(conn, ~p"/privacy")
response = html_response(conn, 200)
assert response =~ "Privacy Policy"
# Should render the privacy policy template
assert response
end
test "GET /privacy renders for authenticated users", %{conn: conn} do
user = user_fixture()
conn = log_in_user(conn, user)
conn = get(conn, ~p"/privacy")
response = html_response(conn, 200)
assert response =~ "Privacy Policy"
end
test "GET /terms renders terms of service page", %{conn: conn} do
conn = get(conn, ~p"/terms")
response = html_response(conn, 200)
assert response =~ "Terms of Service"
# Should render the terms template
assert response
end
test "GET /terms renders for authenticated users", %{conn: conn} do
user = user_fixture()
conn = log_in_user(conn, user)
conn = get(conn, ~p"/terms")
response = html_response(conn, 200)
assert response =~ "Terms of Service"
end
end