mirror of
https://git.youjo.love/youjo/youjo-be.git
synced 2024-11-20 13:59:55 +01:00
added test
This commit is contained in:
parent
680e071dba
commit
c0d572d0bf
1 changed files with 6 additions and 2 deletions
|
@ -24,9 +24,13 @@ defmodule Pleroma.ScheduledActivityTest do
|
|||
|> NaiveDateTime.to_iso8601()
|
||||
|
||||
attrs = %{params: %{}, scheduled_at: today}
|
||||
{:ok, _} = ScheduledActivity.create(user, attrs)
|
||||
{:ok, _} = ScheduledActivity.create(user, attrs)
|
||||
{:ok, sa1} = 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)
|
||||
assert changeset.errors == [scheduled_at: {"daily limit exceeded", []}]
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue