Skip to main content

protocol/testing

packages/protocol/src/testing

Purpose

Public barrel for protocol testing utilities. @moltzap/protocol/testing — test fixtures, typed lifecycle clients, arbitrary derivation, and Toxiproxy adversity helpers.

Public surface

agentId

Function
Validates and decodes agent id values. Returns: The agent id result.

agentKeyArbitrary

Variable
Provides the agent key arbitrary runtime value.

agentKeyString

Function
Provides the agent key string runtime value. Returns: The agent key string result.

agentKeyStringArbitrary

Variable
Provides the agent key string arbitrary runtime value.

agentName

Function
Validates and decodes agent name values. Returns: The agent name result.

AgentRegistrationError

Class
HTTP registration failed (network, non-2xx, malformed response).

connectionId

Variable
Provides the connection id runtime value.

conversationId

Function
Validates and decodes conversation id values. Returns: The conversation id result.

makeTestAgentClient

Function
Creates test agent client. Returns: The created test agent client.

messageId

Function
Validates and decodes message id values. Returns: The message id result.

RealServerAcquireError

Class
Consumer-supplied real-server factory threw or returned an unusable handle.

redactedAgentKey

Function
Validates and decodes redacted agent key values. Returns: The redacted agent key result.

registerTestAgent

Function
Registers test agent. Returns: The register test agent result.

RpcResponseError

Class
Server returned a typed error for a request.

RpcTimeoutError

Class
Wall-clock deadline for a request expired before a response.

TestAgent

Interface
Describes test agent.

TestAgentClient

Interface
Describes test agent client.

TestingError

TypeAlias
Represents testing error conditions.

TestServer

Interface
Describes test server.

TransportClosedError

Class
Peer closed the underlying WS before a response arrived.

TransportIoError

Class
Underlying transport raised (socket error, DNS, TLS, etc.).

userId

Function
Validates and decodes user id values. Returns: The user id result.

waitForValue

Function
Poll probe until it returns a defined value, then return it. Returns: The wait for value result.

waitUntil

Function
Poll predicate until it returns true. Returns: The wait until result.

WIRE_ERROR_TAG

Variable

Files

  • errors.ts
  • lifecycle.ts
  • test-fixtures.ts
  • wait.ts
  • wire-error-tags.ts