yak(behavior-tests-web-controllers-and-auth-edge-cases-o04i): behavior tests: web controllers and auth edge cases
This commit is contained in:
@@ -20,6 +20,29 @@ defmodule FirehoseWeb.BlogTest do
|
||||
body = visit_blog_page(conn, "engineering", "/hello-world")
|
||||
assert body =~ "Hello World"
|
||||
end
|
||||
|
||||
test "GET /blog/engineering?page=2 shows the next page of older posts", %{conn: conn} do
|
||||
# Page size is 10 (`Blogex.Blog.paginate/2`, blogex/lib/blogex/blog.ex:121)
|
||||
# and the test env lists drafts (`show_drafts: true`,
|
||||
# app/config/config.exs), so the 34 visible engineering posts (the
|
||||
# 2099-dated future post is excluded by `all_posts/0`) fill 4 pages.
|
||||
# Page 2, date-descending, runs 2026-07-20 .. 2026-05-14.
|
||||
body = visit_blog_page(conn, "engineering", "?page=2")
|
||||
|
||||
# The pager reports the page the reader asked for, not page 1
|
||||
# (markup: blogex/lib/blogex/components.ex).
|
||||
assert body =~ ~r/Page 2 of \d+/
|
||||
|
||||
# "Synthetic TDD" (2026-07-13) sits mid-page-2: five posts of headroom
|
||||
# before new publications would push it to page 3. Matched as an anchor
|
||||
# because the description of the page-2 post above it also says
|
||||
# "Synthetic TDD".
|
||||
assert body =~ ~s|>Synthetic TDD</a>|
|
||||
|
||||
# The newest post is unambiguously on page 1, so page 2 is a genuinely
|
||||
# different set of posts rather than page 1 relabelled.
|
||||
refute body =~ "I reduced the attack surface"
|
||||
end
|
||||
end
|
||||
|
||||
describe "release notes blog (HTML)" do
|
||||
|
||||
Reference in New Issue
Block a user