forked from mirrors/akkoma
Add unordered list equality matcher
This commit is contained in:
parent
ef422a8385
commit
866672b6a7
|
@ -6,17 +6,19 @@ defmodule Pleroma.HealthcheckTest do
|
||||||
use Pleroma.DataCase, async: true
|
use Pleroma.DataCase, async: true
|
||||||
alias Pleroma.Healthcheck
|
alias Pleroma.Healthcheck
|
||||||
|
|
||||||
|
import Pleroma.Test.Matchers.List
|
||||||
|
|
||||||
test "system_info/0" do
|
test "system_info/0" do
|
||||||
result = Healthcheck.system_info() |> Map.from_struct()
|
result = Healthcheck.system_info() |> Map.from_struct()
|
||||||
|
|
||||||
assert Map.keys(result) == [
|
assert_unordered_list_equal(Map.keys(result), [
|
||||||
:active,
|
:active,
|
||||||
:healthy,
|
:healthy,
|
||||||
:idle,
|
:idle,
|
||||||
:job_queue_stats,
|
:job_queue_stats,
|
||||||
:memory_used,
|
:memory_used,
|
||||||
:pool_size
|
:pool_size
|
||||||
]
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "check_health/1" do
|
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