added test
authorMaksim Pechnikov <parallel588@gmail.com>
Wed, 4 Dec 2019 14:28:57 +0000 (17:28 +0300)
committerMaksim Pechnikov <parallel588@gmail.com>
Wed, 4 Dec 2019 14:28:57 +0000 (17:28 +0300)
test/scheduled_activity_test.exs

index 663cfdd344a00fe7ef779df73b8aaad348633639..b367ae5fbf9c8e2818b10baa8a4ad0fcc635820c 100644 (file)
@@ -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