Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hackartisan committed Jan 9, 2025
1 parent 3f2710b commit d8b094d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion test/dpul_collections_web/controllers/error_html_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule DpulCollectionsWeb.ErrorHTMLTest do
import Phoenix.Template

test "renders 404.html" do
assert render_to_string(DpulCollectionsWeb.ErrorHTML, "404", "html", []) == "Not Found"
assert render_to_string(DpulCollectionsWeb.ErrorHTML, "404", "html", []) =~ "not found"
end

test "renders 500.html" do
Expand Down
21 changes: 8 additions & 13 deletions test/dpul_collections_web/live/item_live_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ defmodule DpulCollectionsWeb.ItemLiveTest do
assert redirected_to(conn, 302) == "/i/învăţămîntul-trebuie-urmărească-dez/item/1"
end

test "/item/{:id} does not redirect with a bad id", %{conn: conn} do
conn = get(conn, "/item/badid1")
assert conn.status == 200
end

test "/i/{:slug}/item/{:id} redirects when slug is incorrect",
%{conn: conn} do
conn = get(conn, "/i/not-a-real-slug/item/1")
Expand Down Expand Up @@ -131,15 +126,15 @@ defmodule DpulCollectionsWeb.ItemLiveTest do
assert response =~ "زلزلہ"
end

test "/i/{:slug}/item/{:id} does not redirect with a bad id", %{conn: conn} do
conn = get(conn, "/i/not-a-real-slug/item/badid1")
response = html_response(conn, 200)
assert response =~ "Item not found"
test "/i/{:slug}/item/{:id} 404s with a bad id", %{conn: conn} do
assert_error_sent 404, fn ->
get(conn, "/i/not-a-real-slug/item/badid1")
end
end

test "GET /item/{:id} response whith a bad id", %{conn: conn} do
conn = get(conn, "/item/badid1")
response = html_response(conn, 200)
assert response =~ "Item not found"
test "GET /item/{:id} 404s with a bad id", %{conn: conn} do
assert_error_sent 404, fn ->
get(conn, "/item/badid1")
end
end
end

0 comments on commit d8b094d

Please sign in to comment.