test: add sitemap.xml endpoint test
Verify content type, urlset structure, post URL presence, and draft exclusion.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user