Add unordered list equality matcher
This commit is contained in:
parent
ef422a8385
commit
866672b6a7
2 changed files with 17 additions and 8 deletions
|
@ -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) == [
|
||||
:active,
|
||||
:healthy,
|
||||
:idle,
|
||||
:job_queue_stats,
|
||||
:memory_used,
|
||||
:pool_size
|
||||
]
|
||||
assert_unordered_list_equal(Map.keys(result), [
|
||||
:active,
|
||||
:healthy,
|
||||
:idle,
|
||||
:job_queue_stats,
|
||||
:memory_used,
|
||||
:pool_size
|
||||
])
|
||||
end
|
||||
|
||||
describe "check_health/1" do
|
||||
|
|
7
test/support/matchers/list.ex
Normal file
7
test/support/matchers/list.ex
Normal 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
|
Loading…
Reference in a new issue