nulla/test/support/fixtures/relations_fixtures.ex
2025-07-04 10:25:40 +02:00

38 lines
880 B
Elixir

defmodule Nulla.RelationsFixtures do
import Nulla.ActorsFixtures
@moduledoc """
This module defines test helpers for creating
entities via the `Nulla.Relations` context.
"""
@doc """
Generate a relation.
"""
def relation_fixture(attrs \\ %{}) do
local_actor = actor_fixture()
remote_actor = actor_fixture()
{:ok, relation} =
attrs
|> Enum.into(%{
blocked_by: true,
blocking: true,
domain_blocking: true,
followed_by: true,
following: true,
muting: true,
muting_notifications: true,
note: "some note",
notifying: true,
requested: true,
showing_replies: true,
showings_reblogs: true,
local_actor_id: local_actor.id,
remote_actor_id: remote_actor.id
})
|> Nulla.Relations.create_relation()
relation
end
end