# `Fleet.Testing`
[🔗](https://github.com/kuku/fleet/blob/main/lib/fleet/testing.ex#L1)

Testing helpers for Fleet background jobs.

Provides utilities to run worker jobs synchronously and assert on enqueued
jobs without starting a full Broadway pipeline.

## Example

    defmodule MyApp.MyWorkerTest do
      use ExUnit.Case, async: true
      use Fleet.Testing, repo: MyApp.Repo

      test "runs the worker" do
        assert :ok = perform_job(MyApp.Workers.SendEmail, %{"to" => "alice@example.com"})

        assert_enqueued(
          worker: MyApp.Workers.FollowUp,
          args: %{"to" => "alice@example.com"}
        )
      end
    end

# `all_enqueued`

Returns all enqueued jobs matching the given filter criteria (`:worker`, `:args`, `:queue`).
Queries both the database (Ecto Sandbox aware) and in-memory test tracker.

# `assert_enqueued`

Asserts that a job matching the given criteria was enqueued.

# `clear_enqueued`

Clears all recorded enqueued jobs.

# `ensure_tracker_started`

Ensures the testing ETS tracker table exists.

# `perform_job`

Runs a worker synchronously with the provided arguments or `Fleet.Job` struct.
Returns the worker's perform result (`:ok`, `{:ok, val}`, `{:error, reason}`, `{:snooze, seconds}`, `{:cancel, reason}`).

# `refute_enqueued`

Asserts that no job matching the given criteria was enqueued.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
