defmodule Ammoprices.Scraping.ScrapeJobTest do use Ammoprices.DataCase use Oban.Testing, repo: Ammoprices.Repo import Ammoprices.Fixtures alias Ammoprices.Scraping.ScrapeJob @fixture_html File.read!("test/fixtures/lucky_gunner/9mm.html") setup do retailer_fixture(%{name: "Lucky Gunner", slug: "lucky-gunner", base_url: "https://www.luckygunner.com"}) retailer_fixture(%{name: "SGAmmo", slug: "sgammo", base_url: "https://www.sgammo.com"}) caliber_fixture(%{name: "9mm Luger", slug: "9mm-luger", category: "handgun", aliases: ["9mm", "9x19"]}) Req.Test.stub(Ammoprices.Scraping.HttpClient, fn conn -> Req.Test.html(conn, @fixture_html) end) :ok end describe "perform/1" do test "executes scrape for all enabled scrapers and calibers" do assert :ok = perform_job(ScrapeJob, %{}) end end end