mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
* lesson library shown as com,ing soon. re-enable learngin strip * replace learning strip text with a lasker quote * remove admin login endpoint * fix crawler directives and prelaunch login - noindex the authenticated scope and the 404 catch-all, and cover the mailing-list confirmation redirect - emit noindex, nofollow from the robots meta and /health, and assert public pages stay indexable and followable - stop inventing lastmod values in the sitemap - log in through /users/log-in during prelaunch now that the admin login endpoint is gone; drop create_admin/2 and its orphaned tests * update caching length to 1 year - name change will invalidate cache * remove logger * fix tablebase path breaking tests * test: check cache headers without requiring built assets CI's test job does not run mix assets.build, so /assets/css/app.css is a 404 there. Committed piece art is already content-hashed and takes the same Plug.Static cache option, so the test no longer needs a build step and passes on a fresh checkout.
46 lines
1.5 KiB
Elixir
46 lines
1.5 KiB
Elixir
defmodule ChesstrainerWeb.CrawlerDirectivesTest do
|
|
use ChesstrainerWeb.ConnCase, async: true
|
|
|
|
@noindex "noindex, nofollow"
|
|
|
|
describe "X-Robots-Tag" do
|
|
test "authenticated routes are noindex even when redirecting to log in", %{conn: conn} do
|
|
conn = get(conn, ~p"/train")
|
|
|
|
assert redirected_to(conn) == ~p"/users/log-in"
|
|
assert get_resp_header(conn, "x-robots-tag") == [@noindex]
|
|
end
|
|
|
|
test "the branded 404 page is noindex", %{conn: conn} do
|
|
conn = get(conn, "/this-page-does-not-exist")
|
|
|
|
assert html_response(conn, 404)
|
|
assert get_resp_header(conn, "x-robots-tag") == [@noindex]
|
|
end
|
|
|
|
test "the mailing-list confirmation redirect is noindex", %{conn: conn} do
|
|
conn = get(conn, "/mailing-list/confirm/oops")
|
|
|
|
assert redirected_to(conn) == "/#mailing-list"
|
|
assert get_resp_header(conn, "x-robots-tag") == [@noindex]
|
|
end
|
|
|
|
test "public pages are not marked noindex", %{conn: conn} do
|
|
for path <- [~p"/", ~p"/privacy", ~p"/terms-conditions", ~p"/mentions-legales"] do
|
|
conn = get(conn, path)
|
|
html = html_response(conn, 200)
|
|
|
|
assert get_resp_header(conn, "x-robots-tag") == []
|
|
refute html =~ ~s(name="robots")
|
|
refute html =~ "nofollow"
|
|
end
|
|
end
|
|
|
|
test "pages that assign :noindex carry the same policy as the header", %{conn: conn} do
|
|
html = conn |> get("/this-page-does-not-exist") |> html_response(404)
|
|
|
|
assert html =~ ~s(<meta name="robots" content="#{@noindex}")
|
|
end
|
|
end
|
|
end
|