# `Octoroom.Agent.Pipeline.Test`
[🔗](https://github.com/samrat/octoroom/blob/v0.1.0/agents/lib/octoroom/agent/pipeline/test.ex#L1)

Runs a pipeline spec in the calling process, with no sockets or
timers, for tests.

    import Octoroom.Agent.Pipeline.Spec
    alias Octoroom.Agent.Pipeline.Test

    harness =
      processor(MyApp.IgnoreBackchannel)
      |> Test.start!()
      |> Test.push([%Frames.VADUserStartedSpeaking{}, %Frames.InterimTranscription{text: "uh-huh"}])

    refute Test.interrupted?(harness)

Async work runs according to `:async`:

  * `:inline` (default) - each task runs to completion in the calling
    process as soon as the frame that started it is handled. Its emitted
    messages are delivered in order, then its result.
  * `:manual` - tasks wait until `run_tasks/1` or `run_task/3`, so a test
    can interrupt while work is in flight.

Timers never fire by themselves; use `fire_timer/3`.

# `t`

```elixir
@type t() :: %Octoroom.Agent.Pipeline.Test{
  async: term(),
  core: term(),
  errors: term(),
  interruptions: term(),
  notifications: term(),
  observed: term(),
  outputs: term(),
  tasks: term(),
  timers: term(),
  upstream: term()
}
```

# `errors`

`{reason, fatal?}` for each error that left the first stage, oldest first.

# `fire_timer`

Fires the pending timer `key` of stage `name`.

# `info`

Delivers a `handle_info/2` message to stage `name`.

# `interrupted?`

True if anything interrupted the pipeline.

# `notifications`

Events sent with `{:notify, event}`, oldest first.

# `outputs`

Frames that left the last stage, oldest first, optionally only of `module`.

# `pending_tasks`

Keys of the tasks waiting to run (`:manual` mode), as `{stage_name, key}`.

# `push`

Pushes a frame (or a list of frames) into the pipeline.

# `received?`

True if a frame of `module` left the last stage.

# `run`

Starts a harness and pushes `frames` downstream. Takes `start/2`'s options.

# `run_task`

Runs the waiting task `key` of stage `name`.

# `run_tasks`

Runs every waiting task, including ones started by those tasks' results.

# `start`

Starts a harness for `spec`. Options: `:async` (`:inline` or `:manual`), `:ctx`.

# `start!`

Like `start/2`, but raises on error.

# `state`

The state of stage `name`.

# `timer_pending?`

True if stage `name` has a pending timer `key`.

# `upstream`

Frames (other than errors) that left the first stage upstream, oldest first.

---

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