Classes

c
FixtureManager

Collects mock plugin definitions and real plugins, produces the IPlugin[] for createTestApp, and resets between tests.

c
MockResponse

In-memory IResponse double with snapshot() and ended getter.

c
MockServiceRegistry

In-memory IServiceRegistry with registration recording.

Functions

f
collectStream(response: Response): Promise<StreamingBody>

Collects a web Response body incrementally via a ReadableStream reader.

f
createMockPlugin(options: MockPluginOptions): IPlugin

Creates an IPlugin that registers a mock service under a capability token.

f
createTestApp(options?: TestAppOptions): Promise<IKernelApplication>

Creates a started test application that can be exercised via inject() and fetch() without binding a socket.

f
createTestContext(options?: TestContextOptions): IRequestContext

Builds a contract-faithful IRequestContext for unit-testing middleware and handlers in isolation (no started app needed).

f
inject(
app: IKernelApplication,
request: string | InjectRequest | Request
): Promise<InjectResponse>

Free-function HTTP request injector with string, InjectRequest, and web-standard Request shorthand.

f
overrideCapability(
token: CapabilityToken,
service: object
): IPlugin

Creates a plugin that REPLACES an already-provided capability with a test double, leaving the rest of the application's composition intact.

Interfaces

I
IKernelApplication

Kernel application extends IApplication with inject() capability.

I
InjectRequest

Inject request shape for IKernelApplication.inject.

I
InjectResponse

Inject response shape returned by IKernelApplication.inject.

I
MockPluginOptions

Options for createMockPlugin.

  • name: string

    Plugin name (also used as the capability token when provides is absent).

  • priority: number

    Registration priority; passed through to the kernel resolver. Omitted when not needed (the returned plugin omits priority too).

  • provides: string

    Capability token this plugin provides. Defaults to name. Override when the plugin name differs from the capability token.

  • register: (ctx: IPluginContext) => void | Promise<void>

    Additional registration callback invoked during register(ctx). Useful for registering middleware, routes, or lifecycle hooks alongside the mock service.

  • service: object

    The mock service object to register.

I
StreamingBody

Parsed body returned by collectStream.

I
TestAppFromApp

Composition-root arm of TestAppOptions: the test starts from the application the project actually ships and subtracts from it.

I
TestAppFromPlugins

Hand-assembled arm of TestAppOptions: the test names the plugins it wants and gets nothing else.

  • app: never

    Not available on this arm — supply plugins or app, never both.

  • autoStart: boolean

    Whether to auto-start the application.

  • overrides: never

    Not available on this arm — supply plugins or app, never both.

  • plugins: IPlugin[]

    Plugins to pre-register before start(). Must include a runtime capability provider (RuntimePlugin() or a mock providing CAPABILITIES.RUNTIME) when autoStart is true — the kernel throws otherwise.

  • without: never

    Not available on this arm — supply plugins or app, never both.

I
TestContextOptions

Options for createTestContext.

Type Aliases

Usage

import * as _setu_ts_testing__First_party_testing_utilities_for_the_Setu_TS_framework__a_test_application_factory__mock_plugin_builder__request_injector__mock_request_context__service_registry_double__response_builder__fixture_manager__and_streaming_response_reader_ from "testing/src/index.ts";