defmodule Account do
def create_user(attrs) do
SampleGenServer.create_user(attrs)
end
end
defmodule SampleGenServer do
def start_link(_), do: ...
def init(_), do: ...
def create_user(attrs) do
GenServer.call(__MODULE__, {:create_user, attrs})
end
def handle_call({:create_user, attrs}, _from, state) do
result = Repo.insert(attrs)
{:reply, result, state}
end
end
In test:
result = Account.create_user(attrs)
assert result == %{:ok, _}
But there’s always an exited error that says ** (exit) exited in: GenServer.call(SampleGenServer) ** (EXIT) time out
How to properly test Account.create_user? Any help would be appreciated. Thanks guys.
I mean the Account.create_user. Because I have coveralls for testing coverage and it won’t pass if I just test the Genserver.call directly. Any idea about the timeout error guys? I tried modifying the queue_target and queue_interval in config but still doesnt work.