# `WardrikTesting.Script`

How `WardrikTesting.Server` answers messages.

Each answer is written to the conversation's log as a run's events would be. Nothing is written
unless the test started `WardrikEvents` under `WardrikTesting.Server.events/1`.

## Messages

  * `echo` waits on the call `call_1`, to the `echo` tool with `%{"text" => "hi"}`.
  * `fail` fails with `"It broke."`.
  * Anything else is answered `"Answered: "` followed by the message.

## Decisions

  * Approving or denying `call_1` answers `"Done."`.
  * Only a scope granted `agent.decide` on the conversation may decide. Others get `:forbidden`.
  * A denial without a reason is recorded as `"Rejected."`, as the hub does.

Cancelling stops the run.

# `ask`

```elixir
@spec ask(Wardrik.Scope.t(), map()) :: {:ok, map()}
```

Answers the message in `input`, as `agent.ask` does.

# `cancel`

```elixir
@spec cancel(Wardrik.Scope.t(), map()) :: {:ok, nil}
```

Cancels the run in `input`, as `agent.cancel` does.

# `decide`

```elixir
@spec decide(Wardrik.Scope.t(), String.t(), map()) ::
  {:ok, map()} | {:error, Wardrik.Error.t()}
```

Approves or denies the call in `input`, as `agent.approve` and `agent.deny` do.

---

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