# `TypeSafeSDK.Test`
[🔗](https://github.com/nshkrdotcom/typesafe_sdk/blob/v0.4.0/lib/typesafe_sdk/test.ex#L1)

Explicit, isolated application fixtures at the Pristine transport seam.

These helpers do not replace serialization, retry classification, decoding or
semantic validation. The configured transport can never call the live API.
A scenario monitors its creating process and can be shared explicitly with
child tasks. Call `verify!/1` before the owner exits, and `close/1` when done.

    client = TypeSafeSDK.Test.client()
    client = TypeSafeSDK.Test.stub(client, urgent: {:noul, 0.9})
    result = TypeSafeSDK.evaluate!(client, "synthetic example", urgent: TypeSafeSDK.noul("Urgent?"))
    TypeSafeSDK.Test.verify!(client)
    TypeSafeSDK.Test.close(client)

Default retries are disabled. Enable the real retry policy explicitly when
using `stub_sequence/2`. Request history is bounded (default 1000) and contains
the actual serialized request; use synthetic data and test credentials only.

# `client`

```elixir
@spec client(keyword()) :: TypeSafeSDK.Client.t()
```

# `close`

```elixir
@spec close(TypeSafeSDK.Client.t()) :: :ok
```

# `requests`

```elixir
@spec requests(TypeSafeSDK.Client.t()) :: list()
```

# `stats`

```elixir
@spec stats(TypeSafeSDK.Client.t()) :: map()
```

# `stub`

```elixir
@spec stub(TypeSafeSDK.Client.t(), map() | list(), keyword()) ::
  TypeSafeSDK.Client.t()
```

# `stub_callback`

Build a fixture from the actual request, for state-dependent or synchronized application tests.

# `stub_http_error`

```elixir
@spec stub_http_error(TypeSafeSDK.Client.t(), integer(), keyword()) ::
  TypeSafeSDK.Client.t()
```

# `stub_models`

```elixir
@spec stub_models(TypeSafeSDK.Client.t(), list(), keyword()) :: TypeSafeSDK.Client.t()
```

# `stub_response`

Raw response escape hatch for testing malformed or future response contracts.

# `stub_sequence`

```elixir
@spec stub_sequence(TypeSafeSDK.Client.t(), list()) :: TypeSafeSDK.Client.t()
```

Finite request/attempt sequence. Exhaustion fails; `verify!/1` checks consumption.

Entries: `{:answers, specs, opts}`, `{:models, models, opts}`,
`{:http_error, status, opts}`, `{:transport_error, reason}`,
`{:response, raw_body, opts}`. The first, second, third and fifth accept omitted opts.

# `stub_transport_error`

```elixir
@spec stub_transport_error(TypeSafeSDK.Client.t(), term()) :: TypeSafeSDK.Client.t()
```

# `verify!`

```elixir
@spec verify!(TypeSafeSDK.Client.t()) :: :ok
```

---

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