test: add sitemap.xml endpoint test

Verify content type, urlset structure, post URL presence, and draft exclusion.
This commit is contained in:
2026-06-25 22:06:49 +02:00
parent 51e425e6dd
commit 5b8236c0a4
2 changed files with 23 additions and 0 deletions
+10
View File
@@ -109,4 +109,14 @@ class ServerTest < Minitest::Test
assert_equal 404, last_response.status
assert_equal "not_found", JSON.parse(last_response.body)["error"]
end
def test_sitemap_endpoint
get "/api/volumen/sitemap.xml"
assert_predicate last_response, :ok?
assert_equal "application/xml", last_response["Content-Type"]&.split(";")&.first
body = last_response.body
assert_includes body, "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">"
assert_includes body, "<loc>https://example.com/hello</loc>"
refute_includes body, "draft"
end
end