Merge branch 'develop' into feature/database-compaction
[akkoma] / test / object_test.exs
index 911757d57c601e83f5e54dbd668247d6e818c2ab..a30efd48c7791cfca8c3c66040c2579f74188a39 100644 (file)
@@ -58,4 +58,26 @@ defmodule Pleroma.ObjectTest do
       assert cached_object.data["type"] == "Tombstone"
     end
   end
+
+  describe "normalizer" do
+    test "fetches unknown objects by default" do
+      %Object{} =
+        object = Object.normalize("http://mastodon.example.org/@admin/99541947525187367")
+
+      assert object.data["url"] == "http://mastodon.example.org/@admin/99541947525187367"
+    end
+
+    test "fetches unknown objects when fetch_remote is explicitly true" do
+      %Object{} =
+        object = Object.normalize("http://mastodon.example.org/@admin/99541947525187367", true)
+
+      assert object.data["url"] == "http://mastodon.example.org/@admin/99541947525187367"
+    end
+
+    test "does not fetch unknown objects when fetch_remote is false" do
+      assert is_nil(
+               Object.normalize("http://mastodon.example.org/@admin/99541947525187367", false)
+             )
+    end
+  end
 end