View Source Nexlm.Providers.Stub.Store (Nexlm v0.1.15)

Per-owner response store backing the stub provider.

Stubs are registered against the process that enqueues them, and any descendant process (via OTP's :$ancestors chain) automatically resolves the same owner entry. State lives in an ETS table keyed by owner pid so async tests stay isolated while still supporting multi-process flows.

Summary

Types

@type model_name() :: String.t()
@type response_fun() :: (Nexlm.Config.t(), map() -> any())

Functions

@spec clear() :: :ok
Link to this function

next_response(model, config, request)

View Source
@spec next_response(model_name(), Nexlm.Config.t(), map()) ::
  {:ok, map()} | {:error, Nexlm.Error.t()}
@spec put(model_name(), map() | tuple() | response_fun()) :: :ok
Link to this function

put_sequence(model, responses)

View Source
@spec put_sequence(model_name(), [map() | tuple() | response_fun()]) :: :ok
Link to this function

with_stub(model, response, fun)

View Source
@spec with_stub(model_name(), map() | tuple() | response_fun(), (-> result)) :: result
when result: var