+ attachment = %{
+ "url" => [%{"href" => URI.encode(name)}]
+ }
+
+ %{name: name, attachment: attachment}
+ end
+
+ test "it adds attachment links to a given text and attachment set", %{
+ name: name,
+ attachment: attachment
+ } do
+ len = 10
+ clear_config([Pleroma.Upload, :filename_display_max_length], len)
+
+ expected =
+ "<br><a href=\"#{URI.encode(name)}\" class='attachment'>#{String.slice(name, 0..len)}…</a>"
+
+ assert Utils.add_attachments("", [attachment]) == expected
+ end