56 lines
1.1 KiB
Elixir
56 lines
1.1 KiB
Elixir
defmodule Homeman.AccountsFixtures do
|
|
@moduledoc """
|
|
This module defines test helpers for creating
|
|
entities via the `Homeman.Accounts` context.
|
|
"""
|
|
|
|
@doc """
|
|
Generate a user.
|
|
"""
|
|
def user_fixture(attrs \\ %{}) do
|
|
{:ok, user} =
|
|
attrs
|
|
|> Enum.into(%{
|
|
avatar_url: "some avatar_url",
|
|
color: "some color",
|
|
name: "some name"
|
|
})
|
|
|> Homeman.Accounts.create_user()
|
|
|
|
user
|
|
end
|
|
|
|
@doc """
|
|
Generate a todo.
|
|
"""
|
|
def todo_fixture(attrs \\ %{}) do
|
|
{:ok, todo} =
|
|
attrs
|
|
|> Enum.into(%{
|
|
completed_at: ~N[2024-01-21 05:40:00],
|
|
description: "some description",
|
|
emoji: "some emoji"
|
|
})
|
|
|> Homeman.Accounts.create_todo()
|
|
|
|
todo
|
|
end
|
|
|
|
@doc """
|
|
Generate a task.
|
|
"""
|
|
def task_fixture(attrs \\ %{}) do
|
|
{:ok, task} =
|
|
attrs
|
|
|> Enum.into(%{
|
|
completed_at: ~N[2024-01-21 05:40:00],
|
|
description: "some description",
|
|
emoji: "some emoji",
|
|
phase: "some phase"
|
|
})
|
|
|> Homeman.Accounts.create_task()
|
|
|
|
task
|
|
end
|
|
end
|