defmodule Towerops.OrganizationsFixtures do
  @moduledoc """
  This module defines test helpers for creating
  entities via the `Towerops.Organizations` context.
  """

  alias Towerops.Organizations

  def unique_organization_name, do: "Test Org #{System.unique_integer()}"

  def valid_organization_attributes(attrs \\ %{}) do
    Enum.into(attrs, %{
      name: unique_organization_name()
    })
  end

  def organization_fixture(user_id, attrs \\ %{}) do
    attrs = valid_organization_attributes(attrs)

    {:ok, organization} = Organizations.create_organization(attrs, user_id)

    organization
  end
end
