- Add conditional "Dashboard" link in navbar that shows when a user is logged in - Tests verify the link is hidden for unauthenticated users and visible when authenticated - Investigation reports for Q1 (drafts/scheduled), Q2 (RSS), Q3 (email subs)
33 lines
980 B
Elixir
33 lines
980 B
Elixir
defmodule FirehoseWeb.PageControllerTest do
|
|
use FirehoseWeb.ConnCase
|
|
|
|
describe "GET /" do
|
|
test "renders the homepage", %{conn: conn} do
|
|
body = conn |> get(~p"/") |> html_response(200)
|
|
assert body =~ "Drinking from the firehose"
|
|
assert body =~ "Willem van den Ende"
|
|
end
|
|
|
|
test "shows navigation links", %{conn: conn} do
|
|
body = conn |> get(~p"/") |> html_response(200)
|
|
assert body =~ ~s|/blog/engineering|
|
|
assert body =~ ~s|/blog/releases|
|
|
assert body =~ ~s|/contact|
|
|
end
|
|
|
|
test "does not show dashboard link when unauthenticated", %{conn: conn} do
|
|
body = conn |> get(~p"/") |> html_response(200)
|
|
refute body =~ ~s|/editor/dashboard|
|
|
end
|
|
end
|
|
|
|
describe "GET / when authenticated" do
|
|
setup :register_and_log_in_user
|
|
|
|
test "shows dashboard link in navigation", %{conn: conn} do
|
|
body = conn |> get(~p"/") |> html_response(200)
|
|
assert body =~ ~s|/editor/dashboard|
|
|
end
|
|
end
|
|
end
|