From 3f2710bca72063e92514df70922ddf05eb73b5b2 Mon Sep 17 00:00:00 2001 From: Anna Headley <845363+hackartisan@users.noreply.github.com> Date: Thu, 9 Jan 2025 16:40:36 -0500 Subject: [PATCH] Add test for empty search results; fixes coverage --- test/dpul_collections_web/live/search_live_test.exs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/dpul_collections_web/live/search_live_test.exs b/test/dpul_collections_web/live/search_live_test.exs index edd4dc5b..0e7e9c51 100644 --- a/test/dpul_collections_web/live/search_live_test.exs +++ b/test/dpul_collections_web/live/search_live_test.exs @@ -42,6 +42,16 @@ defmodule DpulCollectionsWeb.SearchLiveTest do |> Enum.any?() end + test "GET /search with a query that has no results", %{conn: conn} do + {:ok, view, _html} = live(conn, "/search?q=therewontbeanyresults") + + assert view + |> has_element?( + "#item-counter", + "No items found" + ) + end + test "GET /search renders thumbnails for each resource", %{conn: conn} do {:ok, view, _html} = live(conn, "/search?")