Beignet API reference
    Preparing search index...

    Interface CreateTestContextOptions<Ctx, Ports>

    Options for createTestContext(...).

    interface CreateTestContextOptions<Ctx, Ports extends AnyPorts> {
        actor?: ActivityActor;
        ambient?: boolean;
        auth?: unknown;
        base?: { [K in string | number | symbol]?: unknown };
        clock?: ClockPort;
        extra?: Partial<Ctx>;
        ids?: IdGeneratorPort;
        ports?: TestPortsOverrides<Ports>;
        requestId?: string;
        tenant?: ActivityTenant | null;
        traceId?: string;
        transaction?: CreateTestPortsTransactionOptions<Ports, unknown>;
    }

    Type Parameters

    Index

    Actor under test.

    createTestSystemActor("test-system")
    
    ambient?: boolean

    Enter the ambient request context with the test actor, tenant, request ID, and trace ID so ambient enrichment (such as the default audit port) works like production. Call dispose() (or use using) to clear it.

    true
    
    auth?: unknown

    Auth/session value added to the context.

    null
    
    base?: { [K in string | number | symbol]?: unknown }

    App-owned default ports, usually imported from infra/port-wiring. Common Beignet test defaults replace matching keys from base; use ports for app ports that should win.

    clock?: ClockPort

    Clock implementation. Defaults to a frozen clock at the Unix epoch.

    extra?: Partial<Ctx>

    Additional app-specific context fields. An explicit gate here wins over the kit-attached gate.

    ID generator. Defaults to UUIDs.

    Typed partial port overrides that replace generated defaults or base.

    requestId?: string

    Request ID exposed on the context.

    "test-request"
    
    tenant?: ActivityTenant | null

    Tenant under test. Pass null to omit tenant context.

    createTestTenant()
    
    traceId?: string

    Trace ID exposed on the context.

    "test-trace"
    

    Unit of Work configuration. A no-op UOW is installed by default.