From 73d7ed084df9f7c26342aae5e7a2589cd45b21f6 Mon Sep 17 00:00:00 2001 From: Anthony Shull Date: Wed, 20 Dec 2023 17:43:44 -0600 Subject: [PATCH] Fixes two flaky tests (#1836) * flaky test one * flaky test two * updated test * check entire array --- apps/alerts/test/cache/store_test.exs | 3 ++- apps/vehicles/test/repo_test.exs | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/alerts/test/cache/store_test.exs b/apps/alerts/test/cache/store_test.exs index 94a9e1bafc..247b175484 100644 --- a/apps/alerts/test/cache/store_test.exs +++ b/apps/alerts/test/cache/store_test.exs @@ -84,6 +84,7 @@ defmodule Alerts.Cache.StoreTest do alert4 = %Alerts.Alert{id: "126", effect: :cancellation} Store.update([alert1, alert2, alert3, alert4], nil) - assert Store.alert_ids_for_stop_id("543") == ["124", "123"] + + assert Enum.sort(Store.alert_ids_for_stop_id("543")) == Enum.sort(["123", "124"]) end end diff --git a/apps/vehicles/test/repo_test.exs b/apps/vehicles/test/repo_test.exs index 600c99e06e..ab0806d0af 100644 --- a/apps/vehicles/test/repo_test.exs +++ b/apps/vehicles/test/repo_test.exs @@ -34,9 +34,8 @@ defmodule Vehicles.RepoTest do describe "route/1" do test "given a route ID, finds vehicle statuses for that route", %{name: name} do - expected = Enum.filter(@vehicles, &(&1.route_id == "86")) - refute Enum.empty?(expected) - assert Repo.route("86", name: name) == expected + assert Enum.sort(Enum.filter(@vehicles, &(&1.route_id == "86"))) == + Enum.sort(Repo.route("86", name: name)) end test "if there are no vehicles on the route, returns the empty list", %{name: name} do