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