Dedupe poll options
This commit is contained in:
parent
6d0cc8fa2a
commit
10930f7507
2 changed files with 37 additions and 4 deletions
|
|
@ -724,6 +724,32 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
|||
assert object.data["type"] == "Question"
|
||||
assert length(object.data["oneOf"]) == 3
|
||||
end
|
||||
|
||||
test "cannot have only one option", %{conn: conn} do
|
||||
conn =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/statuses", %{
|
||||
"status" => "desu~",
|
||||
"poll" => %{"options" => ["mew"], "expires_in" => 1}
|
||||
})
|
||||
|
||||
%{"error" => error} = json_response_and_validate_schema(conn, 422)
|
||||
assert error == "Poll must contain at least 2 options"
|
||||
end
|
||||
|
||||
test "cannot have only duplicated options", %{conn: conn} do
|
||||
conn =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/statuses", %{
|
||||
"status" => "desu~",
|
||||
"poll" => %{"options" => ["mew", "mew"], "expires_in" => 1}
|
||||
})
|
||||
|
||||
%{"error" => error} = json_response_and_validate_schema(conn, 422)
|
||||
assert error == "Poll must contain at least 2 options"
|
||||
end
|
||||
end
|
||||
|
||||
test "get a status" do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue