Merge branch 'develop' into feature/compat/push-subscriptions
[akkoma] / test / web / twitter_api / representers / object_representer_test.exs
index 791b30237b3032cdc033a71e2739d37818ee6a1e..228b2ac4262cb9654ee08441486bf51c9917f076 100644 (file)
@@ -23,7 +23,32 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ObjectReprenterTest do
       id: 6,
       url: "someurl",
       mimetype: "sometype",
-      oembed: false
+      oembed: false,
+      description: nil
+    }
+
+    assert expected_object == ObjectRepresenter.to_map(object)
+  end
+
+  test "represents mastodon-style attachments" do
+    object = %Object{
+      id: nil,
+      data: %{
+        "mediaType" => "image/png",
+        "name" => "blabla",
+        "type" => "Document",
+        "url" =>
+          "http://mastodon.example.org/system/media_attachments/files/000/000/001/original/8619f31c6edec470.png"
+      }
+    }
+
+    expected_object = %{
+      url:
+        "http://mastodon.example.org/system/media_attachments/files/000/000/001/original/8619f31c6edec470.png",
+      mimetype: "image/png",
+      oembed: false,
+      id: nil,
+      description: "blabla"
     }
 
     assert expected_object == ObjectRepresenter.to_map(object)