Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

fix test (#4001)

RobertJoonas5163880968eb
diff --git a/test/plausible_web/controllers/api/stats_controller/suggestions_test.exs b/test/plausible_web/controllers/api/stats_controller/suggestions_test.exs
index 9f683cfdd6..07b931901c 100644
--- a/test/plausible_web/controllers/api/stats_controller/suggestions_test.exs
+++ b/test/plausible_web/controllers/api/stats_controller/suggestions_test.exs
@@ -268,12 +268,15 @@ defmodule PlausibleWeb.Api.StatsController.SuggestionsTest do
"/api/stats/#{site.domain}/suggestions/hostname?q=host"
)
- assert json_response(conn, 200) ==
- [
- %{"label" => "host-alice.example.com", "value" => "host-alice.example.com"},
- %{"label" => "host-carol.example.com", "value" => "host-carol.example.com"},
- %{"label" => "host-bob.example.com", "value" => "host-bob.example.com"}
- ]
+ suggestions = json_response(conn, 200)
+
+ assert length(suggestions) == 3
+
+ assert %{"label" => "host-alice.example.com", "value" => "host-alice.example.com"} in suggestions
+
+ assert %{"label" => "host-carol.example.com", "value" => "host-carol.example.com"} in suggestions
+
+ assert %{"label" => "host-bob.example.com", "value" => "host-bob.example.com"} in suggestions
end
test "returns suggestions for referrers", %{conn: conn, site: site} do