integrate R module and add url editor ui
Replaces hardcoded paths with R module throughout: - Shop components: layout nav, cart, product links - Controllers: cart, checkout, contact, seo, order lookup - Shop pages: collection, product, search, checkout success, etc. - Site context: nav item url resolution Admin URL management: - Settings page: prefix editor with validation feedback - Page renderer: url_editor component for page URLs - CSS for url editor styling Test updates for cache isolation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,18 +1,25 @@
|
||||
defmodule BerrypodWeb.Plugs.BrokenUrlTrackerTest do
|
||||
use BerrypodWeb.ConnCase, async: true
|
||||
|
||||
alias Berrypod.Redirects
|
||||
import Berrypod.AccountsFixtures
|
||||
|
||||
alias Berrypod.{Redirects, Settings}
|
||||
|
||||
setup do
|
||||
Redirects.create_table()
|
||||
# Create admin user so SetupHook allows access
|
||||
user_fixture()
|
||||
# Mark site as live so requests aren't redirected to /coming-soon
|
||||
{:ok, _} = Settings.set_site_live(true)
|
||||
:ok
|
||||
end
|
||||
|
||||
test "records broken URL on 404", %{conn: conn} do
|
||||
# Multi-segment path — not caught by the /:slug catch-all route
|
||||
conn = get(conn, "/zz/nonexistent-path")
|
||||
|
||||
assert conn.status in [404, 500]
|
||||
# Multi-segment path goes through the catch-all route and raises NotFoundError.
|
||||
# The BrokenUrlTracker plug catches this and records it before re-raising.
|
||||
assert_error_sent :not_found, fn ->
|
||||
get(conn, "/zz/nonexistent-path")
|
||||
end
|
||||
|
||||
[broken_url] = Redirects.list_broken_urls()
|
||||
assert broken_url.path == "/zz/nonexistent-path"
|
||||
@@ -20,7 +27,11 @@ defmodule BerrypodWeb.Plugs.BrokenUrlTrackerTest do
|
||||
end
|
||||
|
||||
test "skips static asset paths", %{conn: conn} do
|
||||
get(conn, "/assets/missing-file.js")
|
||||
# Static asset paths should not be recorded as broken URLs.
|
||||
# These raise NotFoundError but the tracker ignores them.
|
||||
assert_error_sent :not_found, fn ->
|
||||
get(conn, "/assets/missing-file.js")
|
||||
end
|
||||
|
||||
assert Redirects.list_broken_urls() == []
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user