forked from AkkomaGang/akkoma
added test
This commit is contained in:
parent
680e071dba
commit
c0d572d0bf
1 changed files with 6 additions and 2 deletions
|
@ -24,9 +24,13 @@ test "when daily user limit is exceeded" do
|
||||||
|> NaiveDateTime.to_iso8601()
|
|> NaiveDateTime.to_iso8601()
|
||||||
|
|
||||||
attrs = %{params: %{}, scheduled_at: today}
|
attrs = %{params: %{}, scheduled_at: today}
|
||||||
{:ok, _} = ScheduledActivity.create(user, attrs)
|
{:ok, sa1} = ScheduledActivity.create(user, attrs)
|
||||||
{:ok, _} = ScheduledActivity.create(user, attrs)
|
{:ok, sa2} = ScheduledActivity.create(user, attrs)
|
||||||
|
|
||||||
|
jobs =
|
||||||
|
Repo.all(from(j in Oban.Job, where: j.queue == "scheduled_activities", select: j.args))
|
||||||
|
|
||||||
|
assert jobs == [%{"activity_id" => sa1.id}, %{"activity_id" => sa2.id}]
|
||||||
{:error, changeset} = ScheduledActivity.create(user, attrs)
|
{:error, changeset} = ScheduledActivity.create(user, attrs)
|
||||||
assert changeset.errors == [scheduled_at: {"daily limit exceeded", []}]
|
assert changeset.errors == [scheduled_at: {"daily limit exceeded", []}]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue