forked from AkkomaGang/akkoma
Transmogrifier: test fix_attachments/1
This commit is contained in:
parent
185d70ed3d
commit
494149f173
1 changed files with 40 additions and 0 deletions
|
@ -524,4 +524,44 @@ test "returns {:ok, %Object{}} for success case" do
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "fix_attachments/1" do
|
||||
test "transforms dimensions into a url" do
|
||||
object = %{
|
||||
"attachment" => [
|
||||
%{
|
||||
"type" => "Document",
|
||||
"name" => "Hello world",
|
||||
"url" => "https://media.example.tld/1.jpg",
|
||||
"width" => 880,
|
||||
"height" => 960,
|
||||
"mediaType" => "image/jpeg",
|
||||
"blurhash" => "eTKL26+HDjcEIBVl;ds+K6t301W.t7nit7y1E,R:v}ai4nXSt7V@of"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
expected = %{
|
||||
"attachment" => [
|
||||
%{
|
||||
"type" => "Document",
|
||||
"name" => "Hello world",
|
||||
"url" => [
|
||||
%{
|
||||
"type" => "Link",
|
||||
"mediaType" => "image/jpeg",
|
||||
"href" => "https://media.example.tld/1.jpg",
|
||||
"width" => 880,
|
||||
"height" => 960
|
||||
}
|
||||
],
|
||||
"mediaType" => "image/jpeg",
|
||||
"blurhash" => "eTKL26+HDjcEIBVl;ds+K6t301W.t7nit7y1E,R:v}ai4nXSt7V@of"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
assert Transmogrifier.fix_attachments(object) == expected
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue