@appport/testing
v1.0.0
Published
Transport conformance suite and test fixtures for AppPort.
Downloads
68
Readme
@appport/testing
The reference fixture application and the transport conformance suite.
import { createTestApplication, describeTransport } from "@appport/testing";
import { createInProcessTransport } from "@appport/transport-inprocess";
describeTransport("in-process", async ({ sessionId }) => {
const fixture = createTestApplication();
return {
transport: createInProcessTransport({
server: fixture.server,
identity: await fixture.server.identify({ transport: "inprocess", sessionId })
}),
fixture,
teardown: () => fixture.server.close()
};
});Every transport runs the same 21 tests through the same client against the same capabilities: connect and reconnect, request and response, request-id echo, manifest discovery, capability versions, unknown capability, unsupported version, invalid input, application errors, authorization, sanitization, timeouts, concurrency, idempotent replay, events and unsubscribe, streams and cancellation, protocol mismatch, malformed envelopes and malformed carrier data.
Optional sendRaw and sendRawText hooks let a harness inject envelopes the
client would never produce, so protocol-level failures are tested too.
The fixture application is deliberately small and deliberately complete: a request capability, a versioned capability, an event, a stream, a capability that times out and one that fails.
