Agentix.Test.MockProvider (Agentix v0.1.0)

Copy Markdown View Source

A scriptable Agentix.Provider for deterministic tests — no API key, no network.

Enqueue response specs with script/1; each stream/3 call pops the next one (FIFO) and records the request. Build specs with Agentix.Test.completion/2.

Process-based and globally named, so drive it from a single test process and run those tests async: false. Start it with start_supervised!(Agentix.Test.MockProvider) (or Agentix.Test.install_mock_provider/0).

Summary

Functions

Returns a specification to start this module under a supervisor.

The requests received so far, oldest first.

Clear scripts and recorded requests.

Enqueue one response spec (a map from Agentix.Test.completion/2) or a list of them, consumed FIFO by stream/3.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

requests()

@spec requests() :: [map()]

The requests received so far, oldest first.

reset()

@spec reset() :: :ok

Clear scripts and recorded requests.

script(spec)

@spec script(map() | [map()]) :: :ok

Enqueue one response spec (a map from Agentix.Test.completion/2) or a list of them, consumed FIFO by stream/3.

start_link(opts \\ [])

@spec start_link(keyword()) :: Agent.on_start()