From b312ca3d528305ebc3b0c72799af535a406ce251 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Thu, 5 Sep 2019 11:58:02 +0300 Subject: Mastodon API Poll view: Fix handling of polls without an end date --- test/web/mastodon_api/views/status_view_test.exs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/web/mastodon_api/views') diff --git a/test/web/mastodon_api/views/status_view_test.exs b/test/web/mastodon_api/views/status_view_test.exs index 90451cbdc..fcdd7fbcb 100644 --- a/test/web/mastodon_api/views/status_view_test.exs +++ b/test/web/mastodon_api/views/status_view_test.exs @@ -551,6 +551,14 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do assert Enum.at(result[:options], 1)[:votes_count] == 1 assert Enum.at(result[:options], 2)[:votes_count] == 1 end + + test "does not crash on polls with no end date" do + object = Object.normalize("https://skippers-bin.com/notes/7x9tmrp97i") + result = StatusView.render("poll.json", %{object: object}) + + assert result[:expires_at] == nil + assert result[:expired] == false + end end test "embeds a relationship in the account" do -- cgit v1.2.3