Test Poll refresh jobs stream out updates after refetching the object
This commit is contained in:
parent
a2e7db43aa
commit
766edfe5b2
1 changed files with 29 additions and 0 deletions
|
@ -52,4 +52,33 @@ test "poll notification job" do
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
test "poll refresh job" do
|
||||
user = insert(:user, local: false)
|
||||
question = insert(:question, user: user)
|
||||
activity = insert(:question_activity, question: question)
|
||||
|
||||
PollWorker.new(%{"op" => "refresh", "activity_id" => activity.id})
|
||||
|> Oban.insert()
|
||||
|
||||
expected_job_args = %{"activity_id" => activity.id, "op" => "refresh"}
|
||||
|
||||
assert_enqueued(args: expected_job_args)
|
||||
|
||||
with_mocks([
|
||||
{
|
||||
Pleroma.Web.Streamer,
|
||||
[],
|
||||
[
|
||||
stream: fn _, _ -> nil end
|
||||
]
|
||||
}
|
||||
]) do
|
||||
[job] = all_enqueued(worker: PollWorker)
|
||||
PollWorker.perform(job)
|
||||
|
||||
# Ensure updates are streamed out
|
||||
assert called(Pleroma.Web.Streamer.stream(["user", "list", "public", "public:local"], :_))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue