show error page puzzle link only for premium users

This commit is contained in:
2026-11-06 15:47:53 +01:00
parent 785e403370
commit bf176ebd42
9 changed files with 53 additions and 13 deletions
@@ -271,9 +271,25 @@ defmodule ChesstrainerWeb.PageControllerTest do
assert LazyHTML.text(LazyHTML.query(document, "title")) == Branding.title("Page not found")
assert LazyHTML.text(LazyHTML.query(document, ".error-code")) == "404"
assert html =~ "The page you were looking for moved"
assert html =~ "Browse puzzles"
refute html =~ "Browse puzzles"
assert html =~ ~s(class="site-footer")
assert html =~ "/assets/js/marketing.js"
assert html =~ ~s(name="robots")
end
test "premium users see the puzzles link on the 404 page", %{conn: conn} do
{:ok, user} =
user_fixture()
|> Ecto.Changeset.change(plan: :premium)
|> Chesstrainer.Repo.update()
html =
conn
|> log_in_user(user)
|> get("/this-page-does-not-exist")
|> html_response(404)
assert html =~ "Browse puzzles"
assert html =~ ~s(href="/endgames")
end
end