1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-23 00:14:48 +00:00
mobilizon/test/federation/activity_stream/converter/actor_test.exs

31 lines
889 B
Elixir
Raw Normal View History

defmodule Mobilizon.Federation.ActivityStream.Converter.ActorTest do
use Mobilizon.DataCase
2019-09-22 14:26:23 +00:00
alias Mobilizon.Actors.Actor
2020-01-22 01:14:42 +00:00
alias Mobilizon.Federation.ActivityStream.Converter.Actor, as: ActorConverter
describe "actor to AS" do
test "valid actor to as" do
data = ActorConverter.model_to_as(%Actor{type: :Person, preferred_username: "test_account"})
assert is_map(data)
assert data["type"] == :Person
assert data["preferredUsername"] == "test_account"
end
end
describe "AS to Actor" do
test "valid as data to model" do
{:ok, actor} =
ActorConverter.as_to_model_data(%{
"id" => "https://somedomain.tld/users/someone",
"type" => "Person",
"preferredUsername" => "test_account"
})
assert actor.type == "Person"
assert actor.preferred_username == "test_account"
end
end
end