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
end
