Fix FeedController test

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-01-12 11:18:04 +01:00
parent d726e35fd8
commit 0b8538a65b
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -95,8 +95,23 @@ defmodule Mobilizon.Web.FeedControllerTest do
group = insert(:group, visibility: :public) group = insert(:group, visibility: :public)
tag1 = insert(:tag, title: "iCalendar", slug: "icalendar") tag1 = insert(:tag, title: "iCalendar", slug: "icalendar")
tag2 = insert(:tag, title: "Apple", slug: "apple") tag2 = insert(:tag, title: "Apple", slug: "apple")
event1 = insert(:event, organizer_actor: actor, attributed_to: group, tags: [tag1])
event2 = insert(:event, organizer_actor: actor, attributed_to: group, tags: [tag1, tag2]) event1 =
insert(:event,
organizer_actor: actor,
attributed_to: group,
tags: [tag1],
title: "Event One"
)
event2 =
insert(:event,
organizer_actor: actor,
attributed_to: group,
tags: [tag1, tag2],
title: "Event Two",
begins_on: DateTime.add(DateTime.utc_now(), 3_600 * 12 * 4)
)
conn = conn =
conn conn
@ -110,7 +125,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
assert res =~ "BEGIN:VCALENDAR" assert res =~ "BEGIN:VCALENDAR"
assert response_content_type(conn, :calendar) =~ "charset=utf-8" assert response_content_type(conn, :calendar) =~ "charset=utf-8"
[entry1, entry2] = entries = ExIcal.parse(res) [entry2, entry1] = entries = ExIcal.parse(res)
Enum.each(entries, fn entry -> Enum.each(entries, fn entry ->
assert entry.summary in [event1.title, event2.title] assert entry.summary in [event1.title, event2.title]