add published custom pages to sitemap
All checks were successful
deploy / deploy (push) Successful in 1m20s
All checks were successful
deploy / deploy (push) Successful in 1m20s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,11 @@ defmodule BerrypodWeb.SeoControllerTest do
|
||||
import Berrypod.AccountsFixtures
|
||||
import Berrypod.ProductsFixtures
|
||||
|
||||
alias Berrypod.Pages
|
||||
alias Berrypod.Pages.PageCache
|
||||
|
||||
setup do
|
||||
PageCache.invalidate_all()
|
||||
user_fixture()
|
||||
{:ok, _} = Berrypod.Settings.set_site_live(true)
|
||||
:ok
|
||||
@@ -64,5 +68,19 @@ defmodule BerrypodWeb.SeoControllerTest do
|
||||
assert body =~ "<urlset"
|
||||
assert body =~ "</urlset>"
|
||||
end
|
||||
|
||||
test "includes published custom pages", %{conn: conn} do
|
||||
{:ok, _} = Pages.create_custom_page(%{slug: "faq", title: "FAQ", published: true})
|
||||
|
||||
body = get(conn, "/sitemap.xml") |> response(200)
|
||||
assert body =~ "/faq"
|
||||
end
|
||||
|
||||
test "excludes unpublished custom pages", %{conn: conn} do
|
||||
{:ok, _} = Pages.create_custom_page(%{slug: "draft", title: "Draft", published: false})
|
||||
|
||||
body = get(conn, "/sitemap.xml") |> response(200)
|
||||
refute body =~ "/draft"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user