WardrikTesting.Script (wardrik_testing v0.1.0-rc.1)

Copy Markdown

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.

Summary

Functions

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

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

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

Functions

ask(scope, input)

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

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

cancel(scope, map)

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

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

decide(scope, id, input)

@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.