Skip to main content

@flow-state-dev/testing/conformance

Type Aliases​

ConformanceCaseHelpers​

type ConformanceCaseHelpers = object;

Run the inbound-transport conformance suite against an adapter factory. Pass a factory rather than an adapter so the suite can construct fresh instances per case.

Properties​

buildEnvelope​
buildEnvelope: (adapter, host) => Promise<InboundRequestEnvelope>;

Build an envelope through the adapter (transport-specific).

Parameters​
adapter​

InboundTransportAdapter

host​

MockTransportHost

Returns​

Promise<InboundRequestEnvelope>

teardown?​
teardown?: (adapter) => Promise<void> | void;

Tear down any adapter resources (live connections, polls, timers).

Parameters​
adapter​

InboundTransportAdapter

Returns​

Promise<void> | void


CreateInboundTransportConformanceTestsOptions​

type CreateInboundTransportConformanceTestsOptions = object;

Properties​

factory​
factory: () => InboundTransportAdapter;
Returns​

InboundTransportAdapter

helpers​
helpers: ConformanceCaseHelpers;
name​
name: string;

CreateMockTransportHostOptions​

type CreateMockTransportHostOptions = object;

Properties​

resolvePrincipal?​
resolvePrincipal?: (ctx) => Promise<ResolvedPrincipal> | ResolvedPrincipal;

Resolver invoked for resolvePrincipal. Default returns { userId: "test-user", orgId: "org_test" }.

Parameters​
ctx​

PrincipalResolutionContext

Returns​

Promise<ResolvedPrincipal> | ResolvedPrincipal


DispatchCall​

type DispatchCall = object;

Snapshot of a dispatch call captured by the mock host. Adapters under test typically construct an envelope per request — assertions inspect the captured envelopes rather than poking at the adapter's internals.

Properties​

envelope​
envelope: InboundRequestEnvelope;

MockTransportHost​

type MockTransportHost = InboundTransportHost & object;

Mock host produced by createMockTransportHost. Adapters call its dispatch and resolvePrincipal; tests inspect dispatchCalls and principalCalls afterward.

Type Declaration​

dispatchCalls​
readonly dispatchCalls: DispatchCall[];
principalCalls​
readonly principalCalls: PrincipalResolutionContext[];

Functions​

createInboundTransportConformanceTests()​

function createInboundTransportConformanceTests(options): void;

Parameters​

options​

CreateInboundTransportConformanceTestsOptions

Returns​

void


createMockTransportHost()​

function createMockTransportHost(options?): MockTransportHost;

Build a host suitable for adapter tests. Records every dispatch and principal resolution; returns a no-op InboundDispatchHandle so adapters can be exercised without spinning up the runtime.

Parameters​

options?​

CreateMockTransportHostOptions

Returns​

MockTransportHost