+ capture_log(fn ->
+ url = "https://shitposter.club/notice/2827873"
+ {:ok, [activity]} = OStatus.fetch_activity_from_url(url)
+
+ assert activity.data["actor"] == "https://shitposter.club/user/1"
+
+ assert activity.data["object"]["id"] ==
+ "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
+ end)
+ end
+
+ test "it works for atom notes, too" do
+ url = "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056"
+ {:ok, [activity]} = OStatus.fetch_activity_from_url(url)
+ assert activity.data["actor"] == "https://social.sakamoto.gq/users/eal"
+ assert activity.data["object"]["id"] == url
+ end
+ end
+
+ test "it doesn't add nil in the to field" do
+ incoming = File.read!("test/fixtures/nil_mention_entry.xml")
+ {:ok, [activity]} = OStatus.handle_incoming(incoming)
+
+ assert activity.data["to"] == [
+ "http://localhost:4001/users/atarifrosch@social.stopwatchingus-heidelberg.de/followers",
+ "https://www.w3.org/ns/activitystreams#Public"
+ ]
+ end
+
+ describe "is_representable?" do
+ test "Note objects are representable" do
+ note_activity = insert(:note_activity)
+
+ assert OStatus.is_representable?(note_activity)
+ end
+
+ test "Article objects are not representable" do
+ note_activity = insert(:note_activity)
+
+ note_object = Object.normalize(note_activity.data["object"])
+
+ note_data =
+ note_object.data
+ |> Map.put("type", "Article")
+
+ cs = Object.change(note_object, %{data: note_data})
+ {:ok, _article_object} = Repo.update(cs)