Add hint to rules

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-04-06 10:54:59 +02:00
commit ccc3ac241f
9 changed files with 50 additions and 15 deletions

View file

@ -129,16 +129,27 @@ defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do
end
test "get instance rules", %{conn: conn} do
Rule.create(%{text: "Example rule"})
Rule.create(%{text: "Second rule"})
Rule.create(%{text: "Third rule"})
Rule.create(%{text: "Example rule", hint: "Rule description", priority: 1})
Rule.create(%{text: "Third rule", priority: 2})
Rule.create(%{text: "Second rule", priority: 1})
conn = get(conn, "/api/v1/instance")
assert result = json_response_and_validate_schema(conn, 200)
rules = result["rules"]
assert length(rules) == 3
assert [
%{
"text" => "Example rule",
"hint" => "Rule description"
},
%{
"text" => "Second rule",
"hint" => ""
},
%{
"text" => "Third rule",
"hint" => ""
}
] = result["rules"]
end
end