aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-04-22 14:06:39 +0200
committerlain <lain@soykaf.club>2020-04-22 14:06:39 +0200
commit5102468d0f8067548ef233b5947da4bc517f5774 (patch)
tree248c2297790829e33feccb53a9372bd043330f7c /test
parent3c828016d9d1ecb1ebcebb00aaadec2ace37f807 (diff)
downloadpleroma-5102468d0f8067548ef233b5947da4bc517f5774.tar.gz
Polls: Persist and show voters' count
Diffstat (limited to 'test')
-rw-r--r--test/web/mastodon_api/views/poll_view_test.exs16
1 files changed, 14 insertions, 2 deletions
diff --git a/test/web/mastodon_api/views/poll_view_test.exs b/test/web/mastodon_api/views/poll_view_test.exs
index 6211fa888..63b204387 100644
--- a/test/web/mastodon_api/views/poll_view_test.exs
+++ b/test/web/mastodon_api/views/poll_view_test.exs
@@ -43,7 +43,8 @@ defmodule Pleroma.Web.MastodonAPI.PollViewTest do
%{title: "why are you even asking?", votes_count: 0}
],
voted: false,
- votes_count: 0
+ votes_count: 0,
+ voters_count: nil
}
result = PollView.render("show.json", %{object: object})
@@ -69,9 +70,20 @@ defmodule Pleroma.Web.MastodonAPI.PollViewTest do
}
})
+ voter = insert(:user)
+
object = Object.normalize(activity)
- assert %{multiple: true} = PollView.render("show.json", %{object: object})
+ {:ok, _votes, object} = CommonAPI.vote(voter, object, [0, 1])
+
+ assert match?(
+ %{
+ multiple: true,
+ voters_count: 1,
+ votes_count: 2
+ },
+ PollView.render("show.json", %{object: object})
+ )
end
test "detects emoji" do