some reformatting and adjusting so logged in users get moved directly to their feed

This commit is contained in:
2026-04-03 19:40:17 -04:00
parent a926733f1b
commit 874fec835d
19 changed files with 233 additions and 158 deletions

View File

@@ -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