Skip to content

Connectum API Reference / @connectum/testing / index / CreateMockContextOptions

Interface: CreateMockContextOptions ​

Defined in: testing/src/mockContext.ts:22

Options for createMockContext.

Properties ​

catalog ​

readonly catalog: ServiceCatalog

Defined in: testing/src/mockContext.ts:24

The catalog the handler-under-test calls into.


method? ​

readonly optional method?: string

Defined in: testing/src/mockContext.ts:42

The method of the handler under test, as "<service typeName>/<method name>" (for example "t.v1.Hello/Say", the key format of ctx.call). It is what the handler reads as ctx.service, ctx.method and ctx.url. Without it the context describes the first method of the first service of the catalog, which is the right answer only for a catalog of one method.


mocks ​

readonly mocks: readonly MockService[]

Defined in: testing/src/mockContext.ts:26

Mock implementations served via the catalog's resolver path.


outgoingInterceptors? ​

readonly optional outgoingInterceptors?: readonly Interceptor[]

Defined in: testing/src/mockContext.ts:28

Optional outgoing interceptors (applied exactly as in production).


propagateHeaders? ​

readonly optional propagateHeaders?: readonly string[]

Defined in: testing/src/mockContext.ts:34

Optional header names propagated onto outgoing calls (default none).


requestHeader? ​

readonly optional requestHeader?: HeadersInit

Defined in: testing/src/mockContext.ts:30

Optional inbound headers (seen by ctx.requestHeader + header propagation).


signal? ​

readonly optional signal?: AbortSignal

Defined in: testing/src/mockContext.ts:48

Abort signal of the inbound request: ctx.signal aborts when it does, and the abort cascades into the outgoing calls the handler makes. Without it ctx.signal never aborts.


timeoutMs? ​

readonly optional timeoutMs?: number

Defined in: testing/src/mockContext.ts:32

Optional inbound deadline in ms (drives the ctx.timeoutMs() cascade).