Add unordered list equality matcher

This commit is contained in:
FloatingGhost 2023-08-06 15:58:11 +01:00
parent ef422a8385
commit 866672b6a7
2 changed files with 17 additions and 8 deletions

View file

@ -6,17 +6,19 @@ defmodule Pleroma.HealthcheckTest do
use Pleroma.DataCase, async: true
alias Pleroma.Healthcheck
import Pleroma.Test.Matchers.List
test "system_info/0" do
result = Healthcheck.system_info() |> Map.from_struct()
assert Map.keys(result) == [
assert_unordered_list_equal(Map.keys(result), [
:active,
:healthy,
:idle,
:job_queue_stats,
:memory_used,
:pool_size
]
])
end
describe "check_health/1" do

View file

@ -0,0 +1,7 @@
defmodule Pleroma.Test.Matchers.List do
import ExUnit.Assertions
def assert_unordered_list_equal(list_a, list_b) when is_list(list_a) and is_list(list_b) do
assert Enum.sort(list_a) == Enum.sort(list_b)
end
end