towerops/test/towerops_web/controllers/page_controller_test.exs
Graham McIntire 146f5745cf
fix: resolve compilation errors, test failures, and credo issues
- Escape HEEx template braces in GraphQL/API docs with raw(~S[...])
- Fix test assertions for updated marketing copy and UI text
- Extract helper functions in GraphQL resolvers to reduce nesting depth
- Create shared ErrorHelpers module for API controllers
- Fix ETS race condition in brute force whitelist cache for async tests
- Fix property test generators to use ASCII instead of printable unicode
- Add alert_severity helper to site_live/show
- Update accounts fixtures for explicit user confirmation
2026-02-14 12:23:10 -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) =~ "business impact"
assert html_response(conn, 200) =~ "network event"
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