some reformatting and adjusting so logged in users get moved directly to their feed
This commit is contained in:
@@ -1,8 +1,29 @@
|
||||
defmodule MixerWeb.PageControllerTest do
|
||||
use MixerWeb.ConnCase
|
||||
|
||||
test "GET /", %{conn: conn} do
|
||||
test "GET / redirects to /feed when logged in", %{conn: conn} do
|
||||
user =
|
||||
Mixer.Accounts.User
|
||||
|> Ash.Changeset.for_create(
|
||||
:register_with_password,
|
||||
%{
|
||||
email: "test@example.com",
|
||||
password: "Password1!",
|
||||
password_confirmation: "Password1!"
|
||||
}, authorize?: false)
|
||||
|> Ash.create!()
|
||||
|
||||
conn =
|
||||
conn
|
||||
|> Plug.Test.init_test_session(%{})
|
||||
|> AshAuthentication.Plug.Helpers.store_in_session(user)
|
||||
|> get(~p"/")
|
||||
|
||||
assert redirected_to(conn) == ~p"/feed"
|
||||
end
|
||||
|
||||
test "GET / renders the home page for unauthenticated users", %{conn: conn} do
|
||||
conn = get(conn, ~p"/")
|
||||
assert html_response(conn, 200) =~ "Peace of mind from prototype to production"
|
||||
assert html_response(conn, 200) =~ "Mixer"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user