* Made method to getting singular media details; Renamed other related method * Takes a fun and flirty digression to remove abstractions around yt-dlp since I'm 100% committed to using it exclusively * Removed commented test code * Lays the groundwork for fast indexing * Added module for working with youtube RSS feed * Added methods to kick off indexing workers from RSS response * Improve short detection (#59) * Made media attribute-related yt-dlp calls return a struct * Added shorts attribute to media items * Added ability to discern a short from yt-dlp response * Updated search to use new shorts attribute * Fast index UI (#63) * Added fast_index field and adds it to source form * Added fast indexing to source changeset operations * Added fast indexing worker and updated other modules to start using it * Handled fast index worker on source update * Add support modals (#65) * Added fast indexing upgrade modal * Improved modal on smaller screens * Updated links to work again * Added donation modal * Reverted source fast index to 15 minutes * Removed unneeded HTML attributes from old alpine approach
46 lines
1.4 KiB
Elixir
46 lines
1.4 KiB
Elixir
defmodule Pinchflat.Workers.FastIndexingWorkerTest do
|
|
use Pinchflat.DataCase
|
|
|
|
import Mox
|
|
import Pinchflat.SourcesFixtures
|
|
|
|
alias Pinchflat.Sources.Source
|
|
alias Pinchflat.Workers.FastIndexingWorker
|
|
|
|
setup :verify_on_exit!
|
|
|
|
describe "perform/1" do
|
|
test "calls out to Youtube RSS if enabled" do
|
|
expect(HTTPClientMock, :get, fn _url -> {:ok, ""} end)
|
|
source = source_fixture(fast_index: true)
|
|
|
|
perform_job(FastIndexingWorker, %{"id" => source.id})
|
|
end
|
|
|
|
test "reschedules itself if fast indexing is enabled" do
|
|
expect(HTTPClientMock, :get, fn _url -> {:ok, ""} end)
|
|
source = source_fixture(fast_index: true)
|
|
perform_job(FastIndexingWorker, %{"id" => source.id})
|
|
|
|
assert_enqueued(
|
|
worker: FastIndexingWorker,
|
|
args: %{"id" => source.id},
|
|
scheduled_at: now_plus(Source.fast_index_frequency(), :minutes)
|
|
)
|
|
end
|
|
|
|
test "does not call out to Youtube RSS if disabled" do
|
|
expect(HTTPClientMock, :get, 0, fn _url -> {:ok, ""} end)
|
|
source = source_fixture(fast_index: false)
|
|
|
|
perform_job(FastIndexingWorker, %{"id" => source.id})
|
|
end
|
|
|
|
test "does not reschedule itself if fast indexing is disabled" do
|
|
source = source_fixture(fast_index: false)
|
|
perform_job(FastIndexingWorker, %{"id" => source.id})
|
|
|
|
refute_enqueued(worker: FastIndexingWorker, args: %{"id" => source.id})
|
|
end
|
|
end
|
|
end
|