---
title: Testing API
description: Generated public TypeScript reference for @relkit/testing.
search:
  exclude: true
sidebar:
  icon: braces
---

{/* Generated by apps/docs/scripts/generate.ts. Do not edit. */}

## Common APIs

- [invokeFunction](/docs/api/testing#invokefunction)
- [createTestApplication](/docs/api/testing#createtestapplication)

For configuration and examples, read [testing](/docs/modules/operations/testing), [first service](/docs/modules/service/first-service), [first route](/docs/modules/http/first-route).

For a complete workflow, follow [cache product prices](/guides/caching/cache-product-prices), [build an offline agent](/guides/ai/build-an-offline-agent).

## Public imports

- `@relkit/testing` — 72 exports
- `@relkit/testing/drizzle` — 3 exports
- `@relkit/testing/better-auth` — 3 exports

## All exported APIs

Names link to their complete contracts. Re-exports share their original contract; legacy exports keep their separate identity. Examples link to the API's inline sample, a maintained repository usage, or the shared module walkthrough.

| API                                                                                  | Kind  | Import from                                                                 | Example                                                                                                                                                  |
| ------------------------------------------------------------------------------------ | ----- | --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [assertObservabilityHookTypes](/docs/api/testing#assertobservabilityhooktypes)       | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [assertResponseStatus](/docs/api/testing#assertresponsestatus)                       | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createBunHttpListener](/docs/api/testing#createbunhttplistener)                     | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createDeterministicJobsAdapter](/docs/api/testing#createdeterministicjobsadapter-1) | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/fixtures/owned-compatibility.ts#L79)                                 |
| [createHttpTestClient](/docs/api/testing#createhttptestclient)                       | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createJobsConformanceHarness](/docs/api/testing#createjobsconformanceharness-1)     | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createObservabilityAssertions](/docs/api/testing#createobservabilityassertions)     | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createTestAgentStateProvider](/docs/api/testing#createtestagentstateprovider-1)     | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createTestApplication](/docs/api/testing#createtestapplication)                     | Value | `@relkit/testing`                                                           | [API example](/docs/api/testing#createtestapplication)                                                                                                   |
| [createTestApplication](/docs/api/testing#createtestapplication-2)                   | Value | `@relkit/testing/drizzle`                                                   | [Source example](https://github.com/rel-kit/relkit/blob/main/apps/docs/examples/orders-tutorial/steps/database/tests/integration/hello.route.test.ts#L6) |
| [createTestApplication](/docs/api/testing#createtestapplication-1)                   | Value | `@relkit/testing/better-auth`                                               | [Source example](https://github.com/rel-kit/relkit/blob/main/apps/docs/examples/orders-tutorial/steps/tests/tests/integration/hello.route.test.ts#L6)    |
| [createTestBucket](/docs/api/testing#createtestbucket)                               | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createTestBucketFake](/docs/api/testing#createtestbucketfake)                       | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/fixtures/checked-examples.ts#L23)                                    |
| [createTestCache](/docs/api/testing#createtestcache)                                 | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createTestCacheFake](/docs/api/testing#createtestcachefake)                         | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/fixtures/checked-examples.ts#L25)                                    |
| [createTestEvent](/docs/api/testing#createtestevent)                                 | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/compatibility/events.test.ts#L23)                                    |
| [createTestEventFake](/docs/api/testing#createtesteventfake)                         | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createTestFakes](/docs/api/testing#createtestfakes)                                 | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/fixtures/owned-compatibility.ts#L75)                                 |
| [createTestHttpClient](/docs/api/testing#createtesthttpclient)                       | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/fixtures/checked-examples.ts#L31)                                    |
| [createTestHttpListener](/docs/api/testing#createtesthttplistener)                   | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createTestJob](/docs/api/testing#createtestjob-1)                                   | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/compatibility/jobs.test.ts#L14)                                      |
| [createTestJobFake](/docs/api/testing#createtestjobfake-1)                           | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createTestJobsAdapter](/docs/api/testing#createtestjobsadapter-1)                   | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/integration/fixtures/commerce-layout-tasks.native.ts#L33)                             |
| [createTestObservability](/docs/api/testing#createtestobservability)                 | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/integration/http/http.test.ts#L125)                                                   |
| [createTestRealtimeProvider](/docs/api/testing#createtestrealtimeprovider-1)         | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createTestRuntime](/docs/api/testing#createtestruntime-1)                           | Value | `@relkit/testing`                                                           | [API example](/docs/api/testing#createtestruntime-1)                                                                                                     |
| [FunctionContextOf](/docs/api/testing#functioncontextof-type-alias)                  | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [FunctionInput](/docs/api/testing#functioninput-type-alias)                          | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [FunctionOutput](/docs/api/testing#functionoutput-type-alias)                        | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [invokeFunction](/docs/api/testing#invokefunction-1)                                 | Value | `@relkit/testing`                                                           | [API example](/docs/api/testing#invokefunction-1)                                                                                                        |
| [InvokeFunctionOptions](/docs/api/testing#invokefunctionoptions-interface)           | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [JOBS_CONFORMANCE_FIXTURES](/docs/api/testing#jobs_conformance_fixtures-1)           | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [JobsConformanceFixture](/docs/api/testing#jobsconformancefixture-interface)         | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [JobsConformanceHarness](/docs/api/testing#jobsconformanceharness-interface)         | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [RealListenerPurpose](/docs/api/testing#reallistenerpurpose-type-alias)              | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [responseJson](/docs/api/testing#responsejson)                                       | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [responseText](/docs/api/testing#responsetext)                                       | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [runJobsConformance](/docs/api/testing#runjobsconformance-1)                         | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [StandaloneFunctionTarget](/docs/api/testing#standalonefunctiontarget-interface)     | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/integration/http/commerce-native-invocation.ts#L16)                                   |
| [TestApplication](/docs/api/testing#testapplication-interface)                       | Type  | `@relkit/testing`, `@relkit/testing/drizzle`, `@relkit/testing/better-auth` | [Source example](https://github.com/rel-kit/relkit/blob/main/apps/docs/examples/orders-tutorial/steps/tests/tests/integration/orders.route.test.ts#L58)  |
| [TestApplicationOptions](/docs/api/testing#testapplicationoptions-type-alias)        | Type  | `@relkit/testing`, `@relkit/testing/drizzle`, `@relkit/testing/better-auth` | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/fixtures/checked-examples.ts#L90)                                    |
| [TestBucketFake](/docs/api/testing#testbucketfake-interface)                         | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/integration/fixtures/runtime-instrumentation.types.ts#L17)                            |
| [TestBucketFakeOptions](/docs/api/testing#testbucketfakeoptions-interface)           | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestBucketObject](/docs/api/testing#testbucketobject-interface)                     | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestCacheFake](/docs/api/testing#testcachefake-type-alias)                          | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestCacheFakeOptions](/docs/api/testing#testcachefakeoptions-interface)             | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestCacheSnapshot](/docs/api/testing#testcachesnapshot-interface)                   | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestClock](/docs/api/testing#testclock-interface)                                   | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestEventCloseOptions](/docs/api/testing#testeventcloseoptions-interface)           | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestEventDeliveryAttempt](/docs/api/testing#testeventdeliveryattempt-interface)     | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestEventFake](/docs/api/testing#testeventfake-interface)                           | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/contracts/events.ts#L35)                                                              |
| [TestEventOptions](/docs/api/testing#testeventoptions-interface)                     | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestEventPublishResult](/docs/api/testing#testeventpublishresult-type-alias)        | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestEventTriggerOptions](/docs/api/testing#testeventtriggeroptions-interface)       | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestFailureControls](/docs/api/testing#testfailurecontrols-interface)               | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/integration/fixtures/runtime-instrumentation.ts#L45)                                  |
| [TestFakes](/docs/api/testing#testfakes-interface)                                   | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestFakesOptions](/docs/api/testing#testfakesoptions-interface)                     | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestHttpApplication](/docs/api/testing#testhttpapplication-interface)               | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestHttpClient](/docs/api/testing#testhttpclient-interface)                         | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/integration/http/http.test.ts#L55)                                                    |
| [TestHttpClientOptions](/docs/api/testing#testhttpclientoptions-interface)           | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestHttpInput](/docs/api/testing#testhttpinput-type-alias)                          | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestHttpListener](/docs/api/testing#testhttplistener-interface)                     | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/http/ownership.test.ts#L68)                                          |
| [TestHttpListenerOptions](/docs/api/testing#testhttplisteneroptions-interface)       | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestHttpRequest](/docs/api/testing#testhttprequest-type-alias)                      | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestJobCloseOptions](/docs/api/testing#testjobcloseoptions-interface)               | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestJobFake](/docs/api/testing#testjobfake-interface)                               | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/contracts/jobs.ts#L56)                                                                |
| [TestJobOptions](/docs/api/testing#testjoboptions-interface)                         | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestJobsAdapter](/docs/api/testing#testjobsadapter-interface)                       | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/integration/fixtures/commerce-layout-task-run.ts#L24)                                 |
| [TestJobsAdapterOptions](/docs/api/testing#testjobsadapteroptions-interface)         | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestObservability](/docs/api/testing#testobservability-interface)                   | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/integration/http/http.test.ts#L51)                                                    |
| [TestProviderReplacements](/docs/api/testing#testproviderreplacements-type-alias)    | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestRuntime](/docs/api/testing#testruntime-interface)                               | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/compatibility/application-http.test.ts#L31)                          |
| [TestRuntimeCloseOptions](/docs/api/testing#testruntimecloseoptions-interface)       | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestRuntimeOptions](/docs/api/testing#testruntimeoptions-interface)                 | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |

## `application-acquisition.ts`

Acquires the general runtime and explicitly selected application services in one scope.

### acquireApplication

Native application work shares one scope and reverse-order cleanup policy.

**Signature**

```ts
declare const acquireApplication: (
  app: { readonly env: object },
  options: TestApplicationOptions,
) => Effect.Effect<ApplicationHarness, unknown, Scope | TestApplicationPlatform>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-acquisition.ts#L92)

## `application-cleanup.ts`

Finalizers preserve sibling release and report every application cleanup failure.

### cleanup

Collects release failures and retains them in the Cause when acquisition already failed.

**Signature**

```ts
declare const cleanup: (
  release: () => Promise<unknown> | undefined,
  failures: unknown[],
  failed?: boolean,
) => Effect.Effect<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-cleanup.ts#L5)

## `application-drizzle-services.ts`

Selected database-only test acquisition; authentication SDKs are never imported.

### activateDrizzleTestServices

Acquires the sole database and releases it exactly once with the returned owner.

**Signature**

```ts
declare const activateDrizzleTestServices: TestServiceActivator;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-drizzle-services.ts#L21)

## `application-errors.ts`

Normalizes foreign acquisition rejections without replacing native Error identity.

### nativeServiceError

Normalizes foreign acquisition rejections without replacing native Error identity.

**Signature**

```ts
declare const nativeServiceError: <Failure>(cause: Failure) => Error;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-errors.ts#L2)

## `application-generic-services.ts`

General application acquisition never imports a native database or authentication SDK.

### activateGenericTestServices

Rejects an unselected native helper before returning an incomplete application.

**Signature**

```ts
declare const activateGenericTestServices: TestServiceActivator;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-generic-services.ts#L7)

## `application-http.ts`

### handleTestRequest

Dispatches a matched route through existing engine validation and error mapping.

**Signature**

```ts
declare const handleTestRequest: (
  routes: readonly TestRoute[],
  runtime: TestRuntime,
  request: Request,
) => Promise<Response>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-http.ts#L12)

## `application-native-services.types.ts`

Drizzle/Better Auth contracts reachable only through the selected testing helper.

### ApplicationServicesPlatform (interface)

Native dependencies substituted by test Layers without replacing ownership.

**Signature**

```ts
export interface ApplicationServicesPlatform {
  readonly load: (
    root: string,
  ) => Effect.Effect<readonly DescriptorAny[], Error | SourceLocationError>;
  readonly database: typeof activateDrizzleService;
  readonly auth: typeof activateBetterAuthService;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-native-services.types.ts#L13)

### AuthDeclaration (type alias)

**Signature**

```ts
type AuthDeclaration = Parameters<typeof activateBetterAuthService>[0];
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-native-services.types.ts#L10)

### DatabaseDeclaration (type alias)

**Signature**

```ts
type DatabaseDeclaration = Parameters<typeof activateDrizzleService>[0];
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-native-services.types.ts#L9)

### NativeAuth (type alias)

**Signature**

```ts
type NativeAuth = Awaited<ReturnType<typeof activateBetterAuthService>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-native-services.types.ts#L8)

### NativeDatabase (type alias)

**Signature**

```ts
type NativeDatabase = Awaited<ReturnType<typeof activateDrizzleService>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-native-services.types.ts#L7)

## `application-platform.ts`

Replaceable application operations and owned harness authorities.

### TestApplicationHarness (class)

Resources and release failures owned by one application Layer scope.

**Signature**

```ts
declare class TestApplicationHarness
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-platform.ts#L16)

### TestApplicationPlatform (class)

Native application dependencies substituted before acquisition.

**Signature**

```ts
declare class TestApplicationPlatform
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-platform.ts#L10)

### TestApplicationPlatformLive

General live platform; selected native helpers enter through explicit options.

**Signature**

```ts
declare const TestApplicationPlatformLive: Layer.Layer<TestApplicationPlatform, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-platform.ts#L22)

## `application-realtime.ts`

### bindTestRealtime

Binds registered realtime contracts to the acquired test provider generation.

**Signature**

```ts
declare const bindTestRealtime: (
  runtime: TestRuntime,
  artifacts: TestApplicationArtifacts | undefined,
  providers: ProviderRegistry | undefined,
  environment: string,
) => TestRuntime;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-realtime.ts#L15)

## `application-registry.ts`

Loads fresh generated modules with their original native import ancestry and guarded SDK resolution.

### TestApplicationArtifacts

**Signature**

```ts
declare const TestApplicationArtifacts: TestApplicationArtifacts;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-registry.ts#L3)

### loadTestApplicationArtifacts

Loads the generated graph, handlers, and selected integration modules for one test generation.

**Signature**

```ts
declare const loadTestApplicationArtifacts: (
  root: string,
) => Promise<TestApplicationArtifacts | undefined>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-registry.ts#L18)

## `application-registry.types.ts`

### TestApplicationArtifacts (interface)

Compiled graph, registry and native integration evidence acquired by an application.

**Signature**

```ts
export interface TestApplicationArtifacts {
  readonly graph: FunctionRegistryOptions["graph"];
  readonly publicFingerprint: string;
  readonly registry: FunctionRegistry;
  readonly runtimeIntegrationModules: readonly LoadedRuntimeIntegrationModule[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-registry.types.ts#L8)

## `application-request.ts`

Routes application test HTTP through actual runtime invocation and selected service authorities.
Request-local auth and context patches are evaluated per request under the application's owned runtime.

### createApplicationRequest

Binds HTTP admission and request-local authentication to an acquired runtime.

**Signature**

```ts
declare const createApplicationRequest: (
  routes: readonly TestRoute[],
  applicationRuntime: TestRuntime,
  services: TestApplicationServices,
  context: Record<string, unknown>,
) => TestHttpApplication;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-request.ts#L19)

## `application-routes.ts`

### TestFunctionRoute

**Signature**

```ts
declare const TestFunctionRoute: TestFunctionRoute;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.ts#L7)

### TestRawRoute

**Signature**

```ts
declare const TestRawRoute: TestRawRoute;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.ts#L7)

### TestRoute

**Signature**

```ts
declare const TestRoute: TestRoute;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.ts#L7)

### loadTestRoutes

Loads filesystem routes and derives native request/response contracts.

**Signature**

```ts
declare const loadTestRoutes: (root: string) => Promise<readonly TestRoute[]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.ts#L26)

## `application-routes.types.ts`

### AuthoredRoute (type alias)

Native authored route descriptor accepted by application HTTP wiring.

**Signature**

```ts
type AuthoredRoute = Omit<TestFunctionRoute, "method" | "path" | "request" | "responses"> & {
  readonly accept?: "application/json" | "multipart/form-data";
  readonly request?: unknown;
  readonly responses?: TestFunctionRoute["responses"];
  readonly successStatus?: number;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.types.ts#L38)

### TestFunctionRoute (type alias)

Native function-backed HTTP route and its declared exposure/validation contract.

**Signature**

```ts
type TestFunctionRoute = {
  readonly method: string;
  readonly path: string;
  readonly request: unknown;
  readonly target: Parameters<TestRuntime["invoke"]>[0] & {
    readonly input: StandardSchemaV1;
    readonly output: StandardSchemaV1;
    readonly errors?: readonly {
      readonly id: string;
      readonly data: StandardSchemaV1;
      readonly http?: { readonly status: number };
    }[];
  };
  readonly responses: readonly {
    readonly kind?: string;
    readonly id?: string;
    readonly status?: number;
    readonly errorId?: string;
  }[];
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.types.ts#L5)

### TestRawRoute (type alias)

Raw native HTTP route preserving its original handler and method contract.

**Signature**

```ts
type TestRawRoute = {
  readonly method: "ALL";
  readonly path: string;
  readonly handler: (request: Request) => Response | Promise<Response>;
  readonly auth?: { readonly protected: readonly string[] };
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.types.ts#L27)

### TestRoute (type alias)

Supported native function or raw HTTP route declaration.

**Signature**

```ts
type TestRoute = TestFunctionRoute | TestRawRoute;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.types.ts#L35)

## `application-service-auth.ts`

Composes auth over a borrowed database without taking a second disposal authority.

### acquireApplicationAuth

Acquires the optional native auth handler and its protection runtime.

**Signature**

```ts
declare const acquireApplicationAuth: (
  platform: ApplicationServicesPlatform,
  declaration: BetterAuthServiceDescriptor<BetterAuthServiceOptions> | undefined,
  database: DrizzleActivation<DrizzleServiceDescriptor<any, any, any, any>> | undefined,
  routes: ReadonlyArray<TestRoute>,
) => Effect.Effect<Pick<TestApplicationServices, "auth" | "authHandler">, Error, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-service-auth.ts#L22)

### nativeServiceError

**Signature**

```ts
declare const nativeServiceError: <Failure>(cause: Failure) => Error;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-service-auth.ts#L59)

## `application-service-discovery.ts`

Finds native service declarations through the shared, syntax-only layout model.

### loadApplicationServices

Loads only evidenced boundaries, in deterministic order, without activating clients.

**Signature**

```ts
declare const loadApplicationServices: (
  root: string,
) => Effect.Effect<Array<DescriptorAny>, Error, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-service-discovery.ts#L20)

### soleNativeService

Selects the sole native declaration by its capability discriminator.

**Throws**

Error When more than one declaration owns the capability.

**Signature**

```ts
declare const soleNativeService: <Kind extends "drizzle" | "better-auth">(
  services: readonly DescriptorAny[],
  kind: Kind,
) => DescriptorAny | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-service-discovery.ts#L78)

## `application-services.ts`

Owns scoped database/auth activation for a test application in either service layout.

### ApplicationServicesPlatform

**Signature**

```ts
declare const ApplicationServicesPlatform: ApplicationServicesPlatform;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.ts#L17)

### TestApplicationServices

**Signature**

```ts
declare const TestApplicationServices: TestApplicationServices;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.ts#L18)

### TestServices (class)

Database and authentication authorities whose lifetime follows their Layer.

**Signature**

```ts
declare class TestServices
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.ts#L39)

### TestServicesPlatform (class)

Native activation dependencies acquired once per application owner.

**Signature**

```ts
declare class TestServicesPlatform
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.ts#L21)

### TestServicesPlatformLive

Live native adapters; no database or auth client is acquired by this Layer.

**Signature**

```ts
declare const TestServicesPlatformLive: Layer.Layer<TestServicesPlatform, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.ts#L81)

### activateTestServices

Acquires services with an idempotent native shutdown hook.

**Signature**

```ts
declare const activateTestServices: (
  root: string,
  env: ServiceEnvironment,
  routes: readonly TestRoute[],
) => Promise<TestApplicationServices>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.ts#L108)

### testServicesLayer

Builds an owner-scoped Layer over replaceable native dependencies.

**Signature**

```ts
declare const testServicesLayer: (
  root: string,
  env: ServiceEnvironment,
  routes: readonly TestRoute[],
) => Layer.Layer<TestServices, Error, TestServicesPlatform>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.ts#L93)

## `application-services.types.ts`

Native application service ownership and replaceable activation dependencies.

### ServiceEnvironment (type alias)

Uses the existing generic runtime's environment contract without an SDK dependency.

**Signature**

```ts
type ServiceEnvironment = TestRuntime["env"];
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.types.ts#L7)

### TestApplicationServices (interface)

Acquired owner-specific authorities; auth borrows the sole database.

**Signature**

```ts
export interface TestApplicationServices {
  readonly context: NonNullable<TestRuntimeOptions["context"]>;
  readonly auth?: HttpAuthRuntime;
  readonly authHandler?: (request: Request) => Promise<Response>;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.types.ts#L10)

### TestServiceActivator (type alias)

Explicit capability helper selected before application acquisition.

**Signature**

```ts
type TestServiceActivator = (
  root: string,
  env: ServiceEnvironment,
  routes: readonly TestRoute[],
) => Promise<TestApplicationServices>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.types.ts#L18)

## `application.ts`

General test application ownership with explicitly selected capability helpers.

### createTestApplication

Creates an application owner with HTTP, deterministic runtime and provider services.

**Example**

```ts
import { defineEnv } from "@relkit/app/config";
import { createTestApplication } from "@relkit/testing";
async function testApplication(projectRoot: string): Promise<void> {
  const app = await createTestApplication({ env: defineEnv({}) }, { projectRoot });
  try {
    await app.http.get("/");
  } finally {
    await app.close();
  }
}
```

**Signature**

```ts
declare const createTestApplication: (
  app: { readonly env: object },
  options?: TestApplicationOptions,
) => Promise<TestApplication>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.ts#L32)

Since v0.1.0

### TestApplication

**Signature**

```ts
declare const TestApplication: TestApplication;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.ts#L13)

### TestApplicationHarness

**Signature**

```ts
declare const TestApplicationHarness: typeof TestApplicationHarness;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.ts#L9)

### TestApplicationOptions

**Signature**

```ts
declare const TestApplicationOptions: TestApplicationOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.ts#L13)

### TestApplicationPlatform

**Signature**

```ts
declare const TestApplicationPlatform: typeof TestApplicationPlatform;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.ts#L10)

### TestApplicationPlatformLive

**Signature**

```ts
declare const TestApplicationPlatformLive: Layer.Layer<TestApplicationPlatform, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.ts#L11)

### testApplicationLayer

Acquires the application scope using replaceable platform operations.

**Signature**

```ts
declare const testApplicationLayer: (
  app: { readonly env: object },
  options?: TestApplicationOptions,
) => Layer.Layer<TestApplicationHarness, unknown, TestApplicationPlatform>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.ts#L61)

## `application.types.ts`

Describes the owned test application and replaceable acquisition platform.
Generic contracts retain existing runtime environment/context semantics without a native auth or database SDK edge.

### ApplicationHarness (interface)

Effect-owned application request workflow and native application state.

**Signature**

```ts
export interface ApplicationHarness {
  readonly value: Omit<TestApplication, "close">;
  readonly cleanupFailures: unknown[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L40)

### ApplicationPlatform (interface)

Replaceable application acquisition operations used by the owning service Layer.

**Signature**

```ts
export interface ApplicationPlatform {
  readonly artifacts: typeof loadTestApplicationArtifacts;
  readonly routes: typeof loadTestRoutes;
  readonly providers: typeof activateTestProviders;
  readonly services: TestServiceActivator;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L32)

### TestApplication (interface)

Owned compiled test application, direct HTTP facade and complete release boundary.

**Signature**

```ts
export interface TestApplication {
  readonly runtime: TestRuntime;
  readonly http: TestHttpClient;
  readonly clock: TestClock;
  readonly fakes: TestFakes;
  readonly observability: TestObservability;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L22)

### TestApplicationOptions (type alias)

Explicit test application project, environment and native platform inputs.

**Signature**

```ts
type TestApplicationOptions = Omit<TestRuntimeOptions, "app"> & {
  readonly projectRoot?: string;
  readonly bindingValues?: Readonly<Record<string, JsonValue>>;
  readonly resourceProviders?: "configured" | "fake";
  readonly services?: TestServiceActivator;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L14)

## `better-auth.ts`

Explicit database-backed authentication test application facade.

### TestApplication

**Signature**

```ts
declare const TestApplication: TestApplication;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/better-auth.ts#L5)

### TestApplicationOptions

**Signature**

```ts
declare const TestApplicationOptions: TestApplicationOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/better-auth.ts#L5)

### createTestApplication

Acquires auth over a borrowed database while preserving general harness ownership.

**Signature**

```ts
declare const createTestApplication: (
  app: { readonly env: object },
  options?: TestApplicationOptions,
) => Promise<TestApplication>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/better-auth.ts#L8)

## `bucket-storage.schemas.ts`

### BucketStorageSnapshot

Schema authority for detached native fake bucket transfers.

**Signature**

```ts
declare const BucketStorageSnapshot: Schema.Struct<{
  readonly bucketId: Schema.String;
  readonly records: Schema.$Array<
    Schema.Struct<{
      readonly key: Schema.String;
      readonly bytes: Schema.Uint8Array;
      readonly metadata: Schema.Struct<{
        readonly etag: Schema.String;
        readonly contentHash: Schema.optionalKey<Schema.String>;
        readonly size: Schema.optionalKey<Schema.Finite>;
        readonly contentType: Schema.optionalKey<Schema.String>;
        readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
      }>;
    }>
  >;
}>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-storage.schemas.ts#L4)

## `bucket-storage.ts`

### TestBucketStorage (class)

Authoritative writable bucket state; every public read returns detached bytes/metadata.

**Signature**

```ts
declare class TestBucketStorage
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-storage.ts#L22)

### bucketStorageLayer

Owns one isolated bucket, validating options before allocating its temporary root.

**Signature**

```ts
declare const bucketStorageLayer: (
  options?: TestBucketFakeOptions,
) => Layer.Layer<TestBucketStorage, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-storage.ts#L31)

## `bucket-storage.types.ts`

### BucketStorageService (interface)

Effect decisions over authoritative writable bucket bytes and native metadata.

**Signature**

```ts
export interface BucketStorageService {
  readonly stateRoot: string;
  readonly put: (
    ...args: Parameters<NonNullable<BucketProvider["put"]>>
  ) => Effect.Effect<void, unknown>;
  readonly get: (
    ...args: Parameters<NonNullable<BucketProvider["get"]>>
  ) => Effect.Effect<Uint8Array | undefined, unknown>;
  readonly head: (
    ...args: Parameters<NonNullable<BucketProvider["head"]>>
  ) => Effect.Effect<BucketObjectMetadata | undefined, unknown>;
  readonly delete: (
    ...args: Parameters<NonNullable<BucketProvider["delete"]>>
  ) => Effect.Effect<void, unknown>;
  readonly exists: (
    ...args: Parameters<NonNullable<BucketProvider["exists"]>>
  ) => Effect.Effect<boolean, unknown>;
  readonly list: (
    ...args: Parameters<NonNullable<BucketProvider["list"]>>
  ) => Effect.Effect<readonly string[], unknown>;
  readonly inspect: Effect.Effect<readonly TestBucketObject[]>;
  readonly snapshot: Effect.Effect<BucketStorageSnapshot>;
  readonly restore: (snapshot: unknown) => Effect.Effect<void, unknown>;
  readonly clear: Effect.Effect<void>;
  readonly close: Effect.Effect<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-storage.types.ts#L10)

### BucketStorageSnapshot (type alias)

Detached native bucket transfer derived from its decoding schema authority.

**Signature**

```ts
type BucketStorageSnapshot = typeof SnapshotSchema.Type;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-storage.types.ts#L7)

## `bucket-validation.ts`

### assertBucketKey

Rejects unsafe or empty native bucket keys.

**Signature**

```ts
declare const assertBucketKey: (value: string) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-validation.ts#L10)

### assertBucketPrefix

Validates the existing optional bucket listing prefix.

**Signature**

```ts
declare const assertBucketPrefix: (value: string) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-validation.ts#L30)

### copyBucketMetadata

Detaches nested native bucket metadata.

**Signature**

```ts
declare const copyBucketMetadata: (
  value: BucketObjectMetadata | undefined,
) => BucketObjectMetadata | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-validation.ts#L42)

### copyBucketObject

Detaches stored bytes and nested native metadata.

**Signature**

```ts
declare const copyBucketObject: (value: TestBucketObject) => TestBucketObject;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-validation.ts#L57)

## `buckets-types.ts`

Preserved compatibility entrypoint for the canonical domain type companion.

### "./buckets.types.js" (namespace export)

Re-exports all named exports from the "./buckets.types.js" module.

**Signature**

```ts
export * from "./buckets.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets-types.ts#L2)

## `buckets.ts`

### TestBucketFake

**Signature**

```ts
declare const TestBucketFake: TestBucketFake;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.ts#L8)

### TestBucketFakeOptions

**Signature**

```ts
declare const TestBucketFakeOptions: TestBucketFakeOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.ts#L8)

### TestBucketObject

**Signature**

```ts
declare const TestBucketObject: TestBucketObject;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.ts#L8)

### createTestBucket

**Signature**

```ts
declare const createTestBucket: (options?: TestBucketFakeOptions) => TestBucketFake;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.ts#L77)

### createTestBucketFake

Creates an authoritative in-memory provider behind the production Promise client.

**See**

- tests/fixtures/checked-examples.ts ownedHelpersExample for checked resource ownership.

**Signature**

```ts
declare const createTestBucketFake: (options?: TestBucketFakeOptions) => TestBucketFake;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.ts#L16)

## `buckets.types.ts`

### TestBucketFake (interface)

Owned native bucket client with deterministic transfer and inspection controls.

**Signature**

```ts
export interface TestBucketFake extends BucketClient {
  readonly capabilities: { readonly signedReadUrl: false; readonly signedWriteUrl: false };
  readonly provider: BucketProvider;
  readonly client: BucketClient;
  readonly stateRoot: string;
  readonly seed: (key: string, bytes: Uint8Array, options?: BucketPutOptions) => Promise<void>;
  readonly read: (key: string) => Promise<Uint8Array | undefined>;
  readonly inspect: () => readonly TestBucketObject[];
  readonly snapshot: () => import("./bucket-storage.types.js").BucketStorageSnapshot;
  readonly restore: (snapshot: unknown) => void;
  readonly clear: () => void;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.types.ts#L29)

### TestBucketFakeOptions (interface)

Bucket write policy and explicit clock, root and failure dependencies.

**Signature**

```ts
export interface TestBucketFakeOptions {
  readonly bucketId?: string;
  readonly ownerId?: string;
  readonly stateRoot?: string;
  readonly clock?: () => number;
  readonly failures?: TestFailureControls;
  readonly logger?: import("@relkit/runtime-effect").LoggerOptions;
  readonly maxObjectBytes?: number;
  readonly allowedContentTypes?: readonly string[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.types.ts#L10)

### TestBucketObject (interface)

Detached native bucket bytes and metadata selected by a stable key.

**Signature**

```ts
export interface TestBucketObject {
  readonly key: string;
  readonly bytes: Uint8Array;
  readonly metadata: BucketObjectMetadata;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.types.ts#L22)

## `cache-storage-state.ts`

### cacheStorageOperations

Binds native cache validation and committed mutations to one authoritative Ref.

**Signature**

```ts
declare const cacheStorageOperations: (
  state: Ref.Ref<CacheStorageState>,
  policy: CacheStoragePolicy,
) => {
  open: () => CacheStorageState;
  keyOf: (key: unknown) => string;
  active: (context: CacheOperationContext | undefined) => number;
  readEntry: (key: unknown, context: CacheOperationContext | undefined) => CacheEntry | undefined;
  writeEntry: (
    key: unknown,
    value: unknown,
    write: CacheOperationOptions | undefined,
    context: CacheOperationContext | undefined,
  ) => void;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage-state.ts#L17)

## `cache-storage.schemas.ts`

### CacheStorageKey

Restored keys retain the canonical identity produced by the native fake.

**Signature**

```ts
declare const CacheStorageKey: Schema.Struct<{
  readonly cacheId: Schema.String;
  readonly schemaVersion: Schema.Union<readonly [Schema.String, Schema.Number]>;
  readonly key: Schema.Unknown;
}>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.schemas.ts#L4)

### CacheStorageSnapshot

Detached storage transfer; restoring requires matching cache identity/version.

**Signature**

```ts
declare const CacheStorageSnapshot: Schema.Struct<{
  readonly cacheId: Schema.String;
  readonly schemaVersion: Schema.Union<readonly [Schema.String, Schema.Number]>;
  readonly records: Schema.$Array<
    Schema.Struct<{
      readonly key: Schema.String;
      readonly value: Schema.Unknown;
      readonly expiresAt: Schema.optionalKey<Schema.Finite>;
    }>
  >;
}>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.schemas.ts#L11)

## `cache-storage.ts`

### TestCacheStorage (class)

Authoritative writable cache state, never subject to memoization eviction.

**Signature**

```ts
declare class TestCacheStorage
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.ts#L12)

### cacheStorageLayer

Acquires one isolated fake root with scoped release and native cache semantics.

**Signature**

```ts
declare const cacheStorageLayer: (
  options: TestCacheFakeOptions,
) => Layer.Layer<TestCacheStorage, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.ts#L21)

## `cache-storage.types.ts`

### CacheEntry (interface)

Detached authoritative cache value with an optional deterministic expiration timestamp.

**Signature**

```ts
export interface CacheEntry {
  readonly value: unknown;
  readonly expiresAt?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.types.ts#L12)

### CacheStoragePolicy (interface)

Validated native write policy captured once before storage acquisition.

**Signature**

```ts
export interface CacheStoragePolicy {
  readonly cacheId: string;
  readonly schemaVersion: string | number;
  readonly clock: () => number;
  readonly failures: TestFailureControls;
  readonly defaultTtlMs: number | undefined;
  readonly maxTtlMs: number | undefined;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.types.ts#L25)

### CacheStorageService (interface)

Effect decisions over authoritative writable cache state and transfer boundaries.

**Signature**

```ts
export interface CacheStorageService {
  readonly stateRoot: string;
  readonly get: (
    ...args: Parameters<NonNullable<CacheProvider["get"]>>
  ) => Effect.Effect<unknown, unknown>;
  readonly set: (
    ...args: Parameters<NonNullable<CacheProvider["set"]>>
  ) => Effect.Effect<void, unknown>;
  readonly delete: (
    ...args: Parameters<NonNullable<CacheProvider["delete"]>>
  ) => Effect.Effect<void, unknown>;
  readonly has: (
    ...args: Parameters<NonNullable<CacheProvider["has"]>>
  ) => Effect.Effect<boolean, unknown>;
  readonly getOrSet: (
    ...args: Parameters<NonNullable<CacheProvider["getOrSet"]>>
  ) => Effect.Effect<unknown, unknown>;
  readonly increment: (
    ...args: Parameters<NonNullable<CacheProvider["increment"]>>
  ) => Effect.Effect<number, unknown>;
  readonly inspect: Effect.Effect<TestCacheSnapshot>;
  readonly snapshot: Effect.Effect<CacheStorageSnapshot>;
  readonly restore: (snapshot: unknown) => Effect.Effect<void, unknown>;
  readonly clear: Effect.Effect<void>;
  readonly close: Effect.Effect<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.types.ts#L35)

### CacheStorageSnapshot (type alias)

Detached native cache transfer derived from its decoding schema authority.

**Signature**

```ts
type CacheStorageSnapshot = typeof SnapshotSchema.Type;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.types.ts#L9)

### CacheStorageState (interface)

Authoritative state survives until explicit owner release, without eviction.

**Signature**

```ts
export interface CacheStorageState {
  closed: boolean;
  readonly entries: Map<string, CacheEntry>;
  readonly flights: Map<string, Promise<unknown>>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.types.ts#L18)

## `cache-types.ts`

Preserved compatibility entrypoint for the canonical domain type companion.

### "./cache.types.js" (namespace export)

Re-exports all named exports from the "./cache.types.js" module.

**Signature**

```ts
export * from "./cache.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-types.ts#L2)

## `cache.ts`

### TestCacheFake

**Signature**

```ts
declare const TestCacheFake: TestCacheFake<Key, Value>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.ts#L14)

### TestCacheFakeOptions

**Signature**

```ts
declare const TestCacheFakeOptions: TestCacheFakeOptions<KeySchema, ValueSchema>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.ts#L14)

### TestCacheSnapshot

**Signature**

```ts
declare const TestCacheSnapshot: TestCacheSnapshot;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.ts#L14)

### createTestCache

**Signature**

```ts
declare const createTestCache: <
  const KeySchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
  const ValueSchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
>(
  options?: TestCacheFakeOptions<KeySchema, ValueSchema>,
) => TestCacheFake<InferInput<KeySchema>, InferOutput<ValueSchema>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.ts#L98)

### createTestCacheFake

Creates authoritative cache storage behind the production Promise client.

**See**

- tests/fixtures/checked-examples.ts ownedHelpersExample for checked schema inference.

**Signature**

```ts
declare const createTestCacheFake: <
  const KeySchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
  const ValueSchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
>(
  options?: TestCacheFakeOptions<KeySchema, ValueSchema>,
) => TestCacheFake<InferInput<KeySchema>, InferOutput<ValueSchema>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.ts#L24)

## `cache.types.ts`

### TestCacheFake (type alias)

Authoritative writable native cache facade with detached transfer and release controls.

**Signature**

```ts
type TestCacheFake<Key, Value> = CacheClient<Key, Value> & {
  readonly provider: CacheProvider;
  readonly client: CacheClient<Key, Value>;
  readonly capabilities: { readonly increment: true };
  readonly stateRoot: string;
  readonly seed: (key: Key, value: Value, options?: CacheOperationOptions) => Promise<void>;
  readonly read: (key: Key) => Promise<Value | undefined>;
  readonly increment: (
    key: Key,
    delta?: number,
    options?: CacheOperationOptions,
  ) => Promise<number>;
  readonly inspect: () => TestCacheSnapshot;
  readonly snapshot: () => import("./cache-storage.types.js").CacheStorageSnapshot;
  readonly restore: (snapshot: unknown) => void;
  readonly clear: () => void;
  readonly close: () => Promise<void>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.types.ts#L40)

### TestCacheFakeOptions (interface)

Native key/value schemas, TTL policy and explicit fake-owner dependencies.

**Signature**

```ts
export interface TestCacheFakeOptions<
  KeySchema extends StandardSchemaV1 = StandardSchemaV1,
  ValueSchema extends StandardSchemaV1 = StandardSchemaV1,
> {
  readonly cacheId?: string;
  readonly ownerId?: string;
  readonly stateRoot?: string;
  readonly clock?: () => number;
  readonly failures?: TestFailureControls;
  readonly logger?: import("@relkit/runtime-effect").LoggerOptions;
  readonly keySchema?: KeySchema;
  readonly valueSchema?: ValueSchema;
  readonly defaultTtlMs?: number;
  readonly maxTtlMs?: number;
  readonly schemaVersion?: string | number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.types.ts#L10)

### TestCacheSnapshot (interface)

Native cache occupancy and identity evidence without memoization eviction.

**Signature**

```ts
export interface TestCacheSnapshot {
  readonly cacheId: string;
  readonly schemaVersion: string | number;
  readonly entries: number;
  readonly inFlight: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.types.ts#L28)

## `drizzle.ts`

Selected database application harness; database ownership remains scoped to each test.

### TestApplication

**Signature**

```ts
declare const TestApplication: TestApplication;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/drizzle.ts#L5)

### TestApplicationOptions

**Signature**

```ts
declare const TestApplicationOptions: TestApplicationOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/drizzle.ts#L5)

### createTestApplication

Acquires the general harness with the explicit native database service installer.

**Signature**

```ts
declare const createTestApplication: (
  app: { readonly env: object },
  options?: TestApplicationOptions,
) => Promise<TestApplication>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/drizzle.ts#L8)

## `event-controls.types.ts`

### EventControlsService (interface)

Effect publication, delivery, inspection and lifecycle operations over native authorities.

**Signature**

```ts
export interface EventControlsService {
  readonly publish: (
    ...args: Parameters<EventProvider["publish"]>
  ) => Effect.Effect<Awaited<ReturnType<EventProvider["publish"]>>, unknown>;
  readonly pending: (triggerId?: string) => Effect.Effect<number, unknown>;
  readonly completed: (triggerId?: string) => Effect.Effect<number, unknown>;
  readonly runNext: (triggerId?: string) => Effect.Effect<EventDeliveryResult | undefined, unknown>;
  readonly drain: Effect.Effect<readonly EventDeliveryResult[], unknown>;
  readonly restart: Effect.Effect<void, unknown>;
  readonly close: (options?: TestEventCloseOptions) => Effect.Effect<void, unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/event-controls.types.ts#L7)

## `events-inspection.ts`

### completedEventDeliveries

Counts acknowledged durable and ephemeral deliveries.

**Signature**

```ts
declare const completedEventDeliveries: (
  state: TestEventControlState,
  triggerId?: string,
) => number;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-inspection.ts#L38)

### pendingEventDeliveries

Counts eligible durable deliveries and persisted publications still awaiting fanout.

**Signature**

```ts
declare const pendingEventDeliveries: (state: TestEventControlState, triggerId?: string) => number;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-inspection.ts#L10)

## `events-lifecycle.ts`

### eventLifecycle

Composes restart and final release under the event service's scoped ownership.

**Signature**

```ts
declare const eventLifecycle: (
  state: TestEventControlState,
  scope: Scope.Scope,
  context: Context.Context<never>,
) => {
  restart: Effect.Effect<void, unknown, never>;
  close: (failed?: boolean) => Effect.Effect<void, unknown, never>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-lifecycle.ts#L13)

## `events-runtime-controls.ts`

### TestEventControlState

**Signature**

```ts
declare const TestEventControlState: TestEventControlState;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-controls.ts#L5)

### TestEventControls

**Signature**

```ts
declare const TestEventControls: TestEventControls;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-controls.ts#L5)

### TestEventExecution (class)

Delivery admission, retry/fanout and release belong to one event owner.

**Signature**

```ts
declare class TestEventExecution
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-controls.ts#L92)

### createTestEventControls

Exposes synchronous inspection and Promise work through one owned runtime.

**Signature**

```ts
declare const createTestEventControls: (state: TestEventControlState) => Promise<TestEventControls>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-controls.ts#L122)

### eventControlsLayer

Owns the native delivery lifecycle; alternate Layers retain this service contract.

**Signature**

```ts
declare const eventControlsLayer: (
  state: TestEventControlState,
) => Layer.Layer<TestEventExecution, unknown, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-controls.ts#L101)

## `events-runtime-controls.types.ts`

### TestEventControlState (interface)

Native authorities and Effect workflows owned by one event service Layer.

**Signature**

```ts
export interface TestEventControlState {
  readonly logger?: import("@relkit/runtime-effect").LoggerOptions;
  readonly router: () => EventRouter;
  readonly log: () => { readonly close: () => Promise<void> };
  readonly open: Effect.Effect<void, unknown>;
  readonly release: Effect.Effect<void, unknown>;
  readonly work: WorkOwnershipState;
  readonly openFanout: (envelope: UnknownEventEnvelope) => Effect.Effect<void, unknown>;
  readonly owner: TestStateRoot;
  readonly failures: TestFailureControls;
  readonly triggers: readonly {
    readonly id: string;
    readonly eventId: string;
    readonly eventVersion: number;
  }[];
  readonly envelopes: readonly UnknownEventEnvelope[];
  readonly unfanned: Map<string, UnknownEventEnvelope>;
  readonly remember: (result: EventDeliveryResult, envelope: UnknownEventEnvelope) => void;
  readonly publish: (
    ...args: Parameters<EventProvider["publish"]>
  ) => Effect.Effect<Awaited<ReturnType<EventProvider["publish"]>>, unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-controls.types.ts#L10)

### TestEventControls (interface)

Native Promise facade preserving publication, inspection and delivery signatures.

**Signature**

```ts
export interface TestEventControls {
  readonly publishNative: EventProvider["publish"];
  readonly pending: (triggerId?: string) => number;
  readonly runNext: (triggerId?: string) => Promise<EventDeliveryResult | undefined>;
  readonly drain: () => Promise<readonly EventDeliveryResult[]>;
  readonly completed: (triggerId?: string) => number;
  readonly restart: () => Promise<void>;
  readonly close: (options?: TestEventCloseOptions) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-controls.types.ts#L34)

## `events-runtime-open.ts`

### OpenTestEventRuntimeOptions

**Signature**

```ts
declare const OpenTestEventRuntimeOptions: OpenTestEventRuntimeOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-open.ts#L2)

### openTestEventRuntime

Acquires log/router resources and materializes the declared event plan.

**Signature**

```ts
declare const openTestEventRuntime: (
  input: OpenTestEventRuntimeOptions,
) => Effect.Effect<
  { log: EventLog; router: EventRouter; generation: number; storedCount: number },
  unknown,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-open.ts#L17)

## `events-runtime-open.types.ts`

### OpenTestEventRuntimeOptions (interface)

Native log/router acquisition inputs and deterministic generation identity.

**Signature**

```ts
export interface OpenTestEventRuntimeOptions {
  readonly profile: string;
  readonly plan: Parameters<typeof materializeEvents>[0]["plan"];
  readonly owner: TestStateRoot;
  readonly options: TestEventOptions<unknown, unknown>;
  readonly now: () => number;
  readonly random: () => number;
  readonly failures: TestFailureControls;
  readonly runner: InvocationRunner;
  readonly idSource: Parameters<typeof createEventInvoker>[4];
  readonly targets: ReadonlyMap<string, InvocationTarget<unknown, unknown>>;
  readonly generation: number;
  readonly ownerSignal?: () => AbortSignal;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-open.types.ts#L10)

## `events-runtime-utils.ts`

### createEventInvoker

Binds native event invocation to deterministic dependencies and cancellation.

**Signature**

```ts
declare const createEventInvoker: (
  targets: ReadonlyMap<string, InvocationTarget<unknown, unknown>>,
  options: TestEventOptions<unknown, unknown>,
  now: () => number,
  runner: InvocationRunner,
  idSource: InvocationIdSource,
  ownerSignal?: () => AbortSignal,
) => (request: EventInvocationOptions) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-utils.ts#L102)

### createEventTraceBridge

Binds event producer spans to deterministic native invocation identities.

**Signature**

```ts
declare const createEventTraceBridge: (
  eventId: string,
  options: Pick<TestEventOptions<unknown, unknown>, "correlationId" | "causationInvocationId">,
  clock: DeterministicClockService,
  ids: InvocationIdSource,
) => {
  run: <A>(
    operation: () => MaybePromise<A>,
    bridgeOptions?: { readonly name?: string },
  ) => Promise<A>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-utils.ts#L40)

### fanoutEvent

Routes a persisted publication before removing its acknowledgement-gap marker.

**Signature**

```ts
declare const fanoutEvent: (
  router: EventRouter,
  envelope: UnknownEventEnvelope,
  unfanned: Map<string, UnknownEventEnvelope>,
  failures: TestFailureControls,
) => Effect.Effect<void, unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-utils.ts#L149)

### toEnvelope

Detaches an event envelope through the existing canonical JSON authority.

**Signature**

```ts
declare const toEnvelope: (value: Record<string, unknown>) => UnknownEventEnvelope;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-utils.ts#L28)

## `events-runtime.ts`

### TestEventRuntimeOptions

**Signature**

```ts
declare const TestEventRuntimeOptions: TestEventRuntimeOptions<Payload, Output>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime.ts#L6)

### createTestEventRuntime

Builds the native event publication and delivery owner.

**Signature**

```ts
declare const createTestEventRuntime: <Payload, Output>(
  input: TestEventRuntimeOptions<Payload, Output>,
) => Promise<TestEventFake<Payload, Output>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime.ts#L34)

## `events-runtime.types.ts`

### EventRuntimeState (interface)

All publication, fanout and admission state belongs to one event owner.

**Signature**

```ts
export interface EventRuntimeState extends WorkOwnershipState {
  readonly envelopes: UnknownEventEnvelope[];
  readonly attempts: TestEventDeliveryAttempt[];
  readonly unfanned: Map<string, UnknownEventEnvelope>;
  generation: number;
  sequence: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime.types.ts#L35)

### OpenedEventRuntime (type alias)

Native generation acquired by the event owner's ordered Effect workflow.

**Signature**

```ts
type OpenedEventRuntime = Effect.Success<ReturnType<typeof openTestEventRuntime>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime.types.ts#L32)

### TestEventRuntimeOptions (interface)

Dependencies required to acquire one event log/router generation.

**Signature**

```ts
export interface TestEventRuntimeOptions<Payload, Output> {
  readonly eventId: string;
  readonly version: number;
  readonly profile: string;
  readonly triggers: readonly TestTrigger<Output>[];
  readonly plan: Parameters<typeof materializeEvents>[0]["plan"];
  readonly owner: TestStateRoot;
  readonly deterministic: ReturnType<typeof createDeterministicClock>;
  readonly failures: TestFailureControls;
  readonly random: () => number;
  readonly runner: InvocationRunner;
  readonly idSource: InvocationIdSource;
  readonly options: TestEventOptions<Payload, Output>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime.types.ts#L48)

### TestTrigger (type alias)

Normalized event trigger identity, delivery policy and native target.

**Signature**

```ts
type TestTrigger<Output> = TestEventTriggerOptions<Output> & {
  readonly delivery: "ephemeral" | "durable";
  readonly profile: string;
  readonly eventId: string;
  readonly eventVersion: number;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime.types.ts#L24)

## `events-types.ts`

Preserved compatibility entrypoint for the canonical domain type companion.

### "./events.types.js" (namespace export)

Re-exports all named exports from the "./events.types.js" module.

**Signature**

```ts
export * from "./events.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-types.ts#L2)

## `events.ts`

### createTestEvent

Creates a deterministic event publication and delivery harness.

**Signature**

```ts
declare const createTestEvent: <Payload = unknown, Output = unknown>(
  options: TestEventOptions<Payload, Output>,
) => Promise<TestEventFake<Payload, Output>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.ts#L18)

### createTestEventFake

**Signature**

```ts
declare const createTestEventFake: <Payload = unknown, Output = unknown>(
  options: TestEventOptions<Payload, Output>,
) => Promise<TestEventFake<Payload, Output>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.ts#L56)

## `events.types.ts`

### NormalizedTrigger (type alias)

Validated event trigger identity and policy used by native materialization.

**Signature**

```ts
type NormalizedTrigger<Output> = TestEventTriggerOptions<Output> & {
  readonly delivery: "ephemeral" | "durable";
  readonly profile: string;
  readonly eventId: string;
  readonly eventVersion: number;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L119)

### TestEventCloseOptions (interface)

Explicit failed-test state retention policy for event shutdown.

**Signature**

```ts
export interface TestEventCloseOptions {
  readonly failed?: boolean;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L70)

### TestEventDeliveryAttempt (interface)

Native delivery outcome paired with its canonical persisted event envelope.

**Signature**

```ts
export interface TestEventDeliveryAttempt extends EventDeliveryResult {
  readonly envelope: UnknownEventEnvelope;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L75)

### TestEventFake (interface)

Owned native publication/delivery facade with truthful deterministic ledgers.

**Signature**

```ts
export interface TestEventFake<Payload = unknown, Output = unknown> extends EventClient<
  Payload,
  string,
  number,
  Payload
> {
  readonly id: string;
  readonly eventId: string;
  readonly version: number;
  readonly client: EventClient<Payload, string, number, Payload>;
  readonly provider: EventProvider;
  readonly stateRoot: string;
  readonly clock: TestClock;
  readonly failures: TestFailureControls;
  readonly pending: (triggerId?: string) => number;
  readonly runNext: (triggerId?: string) => Promise<EventDeliveryResult | undefined>;
  readonly drain: () => Promise<readonly EventDeliveryResult[]>;
  readonly completed: (triggerId?: string) => number;
  readonly restart: () => Promise<void>;
  readonly envelopes: readonly UnknownEventEnvelope[];
  readonly attempts: readonly TestEventDeliveryAttempt[];
  readonly deliveries: readonly EventDeliveryLedgerRecord[];
  readonly close: (options?: TestEventCloseOptions) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L84)

### TestEventInvocation (type alias)

Native invocation request consumed by an event target fixture.

**Signature**

```ts
type TestEventInvocation = EventInvocationOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L113)

### TestEventOptions (interface)

Event publication contract, native consumers and deterministic fixture dependencies.

**Signature**

```ts
export interface TestEventOptions<Payload = unknown, Output = unknown> {
  readonly logger?: import("@relkit/runtime-effect").LoggerOptions;
  readonly event?: EventDescriptorAny;
  readonly events?: readonly EventDescriptorAny[];
  readonly eventId?: string;
  readonly version?: number;
  readonly payloadSchema?: StandardSchemaV1;
  readonly target?: EventFunctionDescriptorAny;
  readonly triggers?: readonly TestEventTriggerOptions<Output>[];
  readonly triggerId?: string;
  readonly delivery?: "ephemeral" | "durable";
  readonly profile?: string;
  readonly ownerId?: string;
  readonly correlationId?: string;
  readonly causationInvocationId?: string;
  readonly retry?: RetryPolicy;
  readonly concurrency?: number;
  readonly stateRoot?: string;
  readonly startTimeMs?: number;
  readonly leaseDurationMs?: number;
  readonly ephemeralCapacity?: number;
  readonly random?: () => number;
  readonly randomValues?: readonly number[];
  readonly failures?: TestFailureControls;
  readonly env?: Readonly<Record<string, unknown>>;
  readonly clients?: DependencyClientSources;
  readonly hooks?: InvocationHooks;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L40)

### TestEventPublishResult (type alias)

Native accepted publication receipt retained by the public event fixture.

**Signature**

```ts
type TestEventPublishResult = EventPublishResult<string, number, unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L110)

### TestEventTriggerOptions (interface)

Native target and per-trigger delivery, retry and worker concurrency policy.

**Signature**

```ts
export interface TestEventTriggerOptions<Output = unknown> {
  readonly id: string;
  readonly target: EventFunctionDescriptorAny;
  readonly delivery?: "ephemeral" | "durable";
  readonly profile?: string;
  readonly retry?: RetryPolicy;
  readonly concurrency?: number;
  readonly timeoutMs?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L25)

## `fake-utils.ts`

### TestFakeRoot

**Signature**

```ts
declare const TestFakeRoot: TestFakeRoot;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L2)

### assertFailurePoint

Validates the existing dependency-fake failure boundary name.

**Signature**

```ts
declare const assertFailurePoint: (point: string) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L76)

### assertName

Rejects empty dependency client names.

**Signature**

```ts
declare const assertName: (name: string) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L106)

### clone

Detaches native fixture data using structured cloning.

**Signature**

```ts
declare const clone: (value: unknown) => unknown;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L60)

### createFakeRoot

Acquires a category-specific persistence path beneath an owned state root.

**Signature**

```ts
declare const createFakeRoot: (
  requestedPath: string | undefined,
  category: string,
  id: string,
) => TestFakeRoot;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L15)

### lazyRecords

Creates owner-local dependency instances only on first named access.

**Signature**

```ts
declare const lazyRecords: <T>(
  records: Record<string, T>,
  create: (id: string) => T,
) => Record<string, T>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L87)

### noFailures

**Signature**

```ts
declare const noFailures: TestFailureControls;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L64)

### positive

Validates the existing optional positive TTL policy.

**Signature**

```ts
declare const positive: (value: number | undefined, name: string) => number | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L48)

### text

Validates and trims a required fake storage identity.

**Signature**

```ts
declare const text: (value: string, name: string) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L37)

## `fake-utils.types.ts`

Owned native storage subdirectory and idempotent temporary-parent cleanup.

### TestFakeRoot (interface)

Owned native storage subdirectory and idempotent temporary-parent cleanup.

**Signature**

```ts
export interface TestFakeRoot {
  readonly stateRoot: string;
  readonly cleanup: (failed: boolean) => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.types.ts#L2)

## `fakes.ts`

### TestFailureControls

**Signature**

```ts
declare const TestFailureControls: TestFailureControls;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.ts#L6)

### TestFakeProviders (class)

Native dependency sources and their storage release share a single test owner.

**Signature**

```ts
declare class TestFakeProviders
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.ts#L192)

### TestFakes

**Signature**

```ts
declare const TestFakes: TestFakes;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.ts#L6)

### TestFakesOptions

**Signature**

```ts
declare const TestFakesOptions: TestFakesOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.ts#L6)

### createTestFakes

Creates fresh native dependency sources with an owned Effect lifetime.

**Signature**

```ts
declare const createTestFakes: (stateRoot: string, options?: TestFakesOptions) => TestFakes;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.ts#L222)

### fakeProvidersLayer

Acquires synchronous fake dependencies and scopes all storage created lazily later.

**Signature**

```ts
declare const fakeProvidersLayer: (
  stateRoot: string,
  options?: TestFakesOptions,
) => Layer.Layer<TestFakeProviders, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.ts#L202)

## `fakes.types.ts`

### TestFailureControls (interface)

Owner-local native failure injection with explicit one-shot and persistent boundaries.

**Signature**

```ts
export interface TestFailureControls {
  readonly failAt: (point: string, cause?: unknown) => void;
  readonly once?: (point: string, cause?: unknown) => void;
  readonly clear: (point?: string) => void;
  readonly check: (point: string) => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.types.ts#L7)

### TestFakes (interface)

Owned native dependency sources and authoritative writable storage fixtures.

**Signature**

```ts
export interface TestFakes {
  readonly stateRoot: string;
  readonly clients: DependencyClientSources;
  readonly buckets: Readonly<Record<string, TestBucketFake>>;
  readonly cache: Readonly<Record<string, TestCacheFake<unknown, unknown>>>;
  readonly providers: TestProviderReplacements;
  readonly createBucket: (
    id: string,
    options?: Omit<TestBucketFakeOptions, "bucketId" | "stateRoot" | "failures" | "clock">,
  ) => TestBucketFake;
  readonly createCache: (
    id: string,
    options?: Omit<TestCacheFakeOptions, "cacheId" | "stateRoot" | "failures" | "clock">,
  ) => TestCacheFake<unknown, unknown>;
  readonly setClient: (category: DependencyCategory, name: string, client: unknown) => void;
  readonly removeClient: (category: DependencyCategory, name: string) => void;
  readonly failures: TestFailureControls;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.types.ts#L22)

### TestFakesOptions (interface)

Explicit clock, logger and provider replacement policy for one fake owner.

**Signature**

```ts
export interface TestFakesOptions {
  readonly logger?: import("@relkit/runtime-effect").LoggerOptions;
  readonly clock?: () => number;
  readonly providers?: TestProviderReplacements;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.types.ts#L15)

## `http-listener.ts`

### RealListenerPurpose

**Signature**

```ts
declare const RealListenerPurpose: RealListenerPurpose;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.ts#L7)

### TestHttpListener

**Signature**

```ts
declare const TestHttpListener: TestHttpListener;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.ts#L9)

### TestHttpListenerOptions

**Signature**

```ts
declare const TestHttpListenerOptions: TestHttpListenerOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.ts#L8)

### createBunHttpListener

**Signature**

```ts
declare const createBunHttpListener: (
  app: TestHttpApplication,
  options?: TestHttpListenerOptions,
) => Promise<TestHttpListener>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.ts#L44)

### createTestHttpListener

Starts the real-socket path reserved for disconnect, streaming, and proxy tests.

**Signature**

```ts
declare const createTestHttpListener: (
  app: TestHttpApplication,
  options?: TestHttpListenerOptions,
) => Promise<TestHttpListener>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.ts#L19)

## `http-listener.types.ts`

### RealListenerPurpose (type alias)

Native behavior requiring a real Bun listener in compatibility acceptance.

**Signature**

```ts
type RealListenerPurpose = "disconnect" | "stream" | "proxy";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.types.ts#L4)

### TestHttpListener (interface)

Owned real Bun server handle and native request/release boundary.

**Signature**

```ts
export interface TestHttpListener {
  readonly purpose: RealListenerPurpose;
  readonly url: URL;
  readonly server: Bun.Server<undefined>;
  readonly request: TestHttpRequest;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.types.ts#L16)

### TestHttpListenerOptions (interface)

Explicit native socket identity, timeout and disconnect test policy.

**Signature**

```ts
export interface TestHttpListenerOptions {
  readonly purpose?: RealListenerPurpose;
  readonly hostname?: string;
  readonly port?: number;
  readonly idleTimeout?: number;
  readonly closeTimeoutMs?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.types.ts#L7)

## `http-owner.ts`

### TestHttpOwner (class)

Listener admission, startup races and complete shutdown belong to one client owner.

**Signature**

```ts
declare class TestHttpOwner
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-owner.ts#L20)

### TestHttpPlatform (class)

Native listener acquisition; tests substitute failures without opening real sockets.

**Signature**

```ts
declare class TestHttpPlatform
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-owner.ts#L10)

### TestHttpPlatformLive

**Signature**

```ts
declare const TestHttpPlatformLive: Layer.Layer<TestHttpPlatform, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-owner.ts#L14)

### httpOwnerLayer

Owns listener admission, late startup adoption and complete release as Effect decisions.

**Signature**

```ts
declare const httpOwnerLayer: (
  app: TestHttpApplication,
  options: TestHttpClientOptions,
) => Layer.Layer<TestHttpOwner, never, TestHttpPlatform>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-owner.ts#L31)

## `http-owner.types.ts`

### HttpOwnerService (interface)

Effect listener admission and complete shutdown over native listener handles.

**Signature**

```ts
export interface HttpOwnerService {
  readonly listen: (options?: TestHttpListenerOptions) => Effect.Effect<TestHttpListener, unknown>;
  readonly close: Effect.Effect<void, unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-owner.types.ts#L14)

### HttpOwnerState (interface)

Listener handles and real startup completion retained by one scoped HTTP owner.

**Signature**

```ts
export interface HttpOwnerState {
  closed: boolean;
  readonly listeners: Set<TestHttpListener>;
  readonly pending: Set<Promise<unknown>>;
  readonly startupReleaseFailures: unknown[];
  closing: Promise<void> | undefined;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-owner.types.ts#L20)

### HttpPlatformService (interface)

Replaceable native listener acquisition authority for one HTTP owner.

**Signature**

```ts
export interface HttpPlatformService {
  readonly listen: typeof createTestHttpListener;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-owner.types.ts#L9)

## `http.ts`

### RealListenerPurpose

**Signature**

```ts
declare const RealListenerPurpose: RealListenerPurpose;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L94)

### TestHttpApplication

**Signature**

```ts
declare const TestHttpApplication: TestHttpApplication;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L16)

### TestHttpClient

**Signature**

```ts
declare const TestHttpClient: TestHttpClient;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L18)

### TestHttpClientOptions

**Signature**

```ts
declare const TestHttpClientOptions: TestHttpClientOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L17)

### TestHttpInput

**Signature**

```ts
declare const TestHttpInput: TestHttpInput;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L14)

### TestHttpListener

**Signature**

```ts
declare const TestHttpListener: TestHttpListener;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L95)

### TestHttpListenerOptions

**Signature**

```ts
declare const TestHttpListenerOptions: TestHttpListenerOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L96)

### TestHttpRequest

**Signature**

```ts
declare const TestHttpRequest: TestHttpRequest;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L15)

### TestObservability

**Signature**

```ts
declare const TestObservability: TestObservability;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L19)

### assertObservabilityHookTypes

Asserts event order and the existing observability protocol/version.

**Signature**

```ts
declare const assertObservabilityHookTypes: (
  hooks: Pick<InspectableObservabilityHooks, "read">,
  expected: readonly ObservabilityHookEvent["type"][],
) => readonly ObservabilityHookEvent[];
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L162)

### assertResponseStatus

Asserts the existing native HTTP response status.

**Signature**

```ts
declare const assertResponseStatus: (response: Response, expected: number) => Response;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L105)

### createBunHttpListener

**Signature**

```ts
declare const createBunHttpListener: (
  app: TestHttpApplication,
  options?: TestHttpListenerOptions,
) => Promise<TestHttpListener>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L92)

### createHttpTestClient

**Signature**

```ts
declare const createHttpTestClient: (
  app: TestHttpApplication,
  options?: TestHttpClientOptions,
) => TestHttpClient;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L90)

### createObservabilityAssertions

**Signature**

```ts
declare const createObservabilityAssertions: () => TestObservability;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L154)

### createTestHttpClient

Sends ordinary route tests through the app's in-memory request entry point.

**Signature**

```ts
declare const createTestHttpClient: (
  app: TestHttpApplication,
  options?: TestHttpClientOptions,
) => TestHttpClient;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L41)

### createTestHttpListener

**Signature**

```ts
declare const createTestHttpListener: (
  app: TestHttpApplication,
  options?: TestHttpListenerOptions,
) => Promise<TestHttpListener>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L91)

### createTestObservability

Creates a protocol/version-checked capture for engine-backed HTTP tests.

**Signature**

```ts
declare const createTestObservability: () => TestObservability;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L141)

### responseJson

Reads JSON after the optional native status assertion.

**Signature**

```ts
declare const responseJson: <T = unknown>(
  response: Response,
  expectedStatus?: number,
) => Promise<T>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L118)

### responseText

Reads text after the optional native status assertion.

**Signature**

```ts
declare const responseText: (response: Response, expectedStatus?: number) => Promise<string>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L132)

## `http.types.ts`

### TestHttpApplication (interface)

The app request/fetch methods satisfy this boundary without leaking framework types.

**Signature**

```ts
export interface TestHttpApplication {
  readonly request?: (input: TestHttpInput, init?: RequestInit) => Response | Promise<Response>;
  readonly fetch?: (request: Request) => Response | Promise<Response>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L12)

### TestHttpClient (interface)

Owned HTTP test facade exposing direct requests and optional real listeners.

**Signature**

```ts
export interface TestHttpClient {
  readonly request: TestHttpRequest;
  readonly get: TestHttpRequest;
  readonly post: TestHttpRequest;
  readonly put: TestHttpRequest;
  readonly patch: TestHttpRequest;
  readonly delete: TestHttpRequest;
  readonly listen: (options?: TestHttpListenerOptions) => Promise<TestHttpListener>;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L28)

### TestHttpClientOptions (interface)

Explicit test origin, listener close policy and ownership callbacks.

**Signature**

```ts
export interface TestHttpClientOptions {
  readonly logger?: import("@relkit/runtime-effect").LoggerOptions;
  readonly baseUrl?: string | URL;
  /** Registers client shutdown with the owning test runtime/application. */
  readonly registerClose?: (close: () => Promise<void>) => void;
  readonly onClose?: () => MaybePromise<void>;
  readonly closeTimeoutMs?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L18)

### TestHttpInput (type alias)

Native Request, URL or relative path accepted by direct HTTP fixtures.

**Signature**

```ts
type TestHttpInput = Request | string | URL;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L6)

### TestHttpRequest (type alias)

Native in-memory request operation preserving RequestInit and Response contracts.

**Signature**

```ts
type TestHttpRequest = (input: TestHttpInput, init?: RequestInit) => Promise<Response>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L9)

### TestObservability (interface)

Native engine event capture with ordered protocol/version assertions.

**Signature**

```ts
export interface TestObservability {
  readonly hooks: InspectableObservabilityHooks;
  readonly read: () => readonly ObservabilityHookEvent[];
  readonly types: () => readonly ObservabilityHookEvent["type"][];
  readonly assertTypes: (
    expected: readonly ObservabilityHookEvent["type"][],
  ) => readonly ObservabilityHookEvent[];
  readonly clear: () => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L40)

## `identity.ts`

### TestIdentity (class)

Native trace/span/invocation identity sequence belongs to one deterministic owner.

**Signature**

```ts
declare class TestIdentity
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/identity.ts#L7)

### createTestIdentitySource

Exposes native synchronous identity generation over the same service contract.

**Signature**

```ts
declare const createTestIdentitySource: () => InvocationIdSource;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/identity.ts#L47)

### identityLayer

Builds the identity service once per provisioned owner.

**Signature**

```ts
declare const identityLayer: () => Layer.Layer<TestIdentity, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/identity.ts#L39)

## `identity.types.ts`

### TestIdentityService (interface)

Deterministic identity allocation authority shared by one test owner.

**Signature**

```ts
export interface TestIdentityService {
  readonly next: (kind: Parameters<InvocationIdSource["next"]>[0]) => Effect.Effect<ProtocolId>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/identity.types.ts#L6)

## `index.ts`

Exposes generic application test owners and fakes; native helpers have feature entrypoints.

### FunctionContextOf

**Signature**

```ts
declare const FunctionContextOf: FunctionContextOf<Target>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L4)

### FunctionInput

**Signature**

```ts
declare const FunctionInput: FunctionInput<Target>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L5)

### FunctionOutput

**Signature**

```ts
declare const FunctionOutput: FunctionOutput<Target>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L6)

### InvokeFunctionOptions

**Signature**

```ts
declare const InvokeFunctionOptions: InvokeFunctionOptions<Context>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L7)

### JOBS_CONFORMANCE_FIXTURES

**Signature**

```ts
declare const JOBS_CONFORMANCE_FIXTURES: ReadonlyArray<JobsConformanceFixture>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L57)

### JobsConformanceFixture

**Signature**

```ts
declare const JobsConformanceFixture: JobsConformanceFixture;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L59)

### JobsConformanceHarness

**Signature**

```ts
declare const JobsConformanceHarness: JobsConformanceHarness;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L59)

### RealListenerPurpose

**Signature**

```ts
declare const RealListenerPurpose: RealListenerPurpose;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L40)

### StandaloneFunctionTarget

**Signature**

```ts
declare const StandaloneFunctionTarget: StandaloneFunctionTarget;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L8)

### TestApplication

**Signature**

```ts
declare const TestApplication: TestApplication;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L18)

### TestApplicationOptions

**Signature**

```ts
declare const TestApplicationOptions: TestApplicationOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L18)

### TestBucketFake

**Signature**

```ts
declare const TestBucketFake: TestBucketFake;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L24)

### TestBucketFakeOptions

**Signature**

```ts
declare const TestBucketFakeOptions: TestBucketFakeOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L24)

### TestBucketObject

**Signature**

```ts
declare const TestBucketObject: TestBucketObject;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L24)

### TestCacheFake

**Signature**

```ts
declare const TestCacheFake: TestCacheFake<Key, Value>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L26)

### TestCacheFakeOptions

**Signature**

```ts
declare const TestCacheFakeOptions: TestCacheFakeOptions<KeySchema, ValueSchema>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L26)

### TestCacheSnapshot

**Signature**

```ts
declare const TestCacheSnapshot: TestCacheSnapshot;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L26)

### TestClock

**Signature**

```ts
declare const TestClock: TestClock;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L12)

### TestEventCloseOptions

**Signature**

```ts
declare const TestEventCloseOptions: TestEventCloseOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L62)

### TestEventDeliveryAttempt

**Signature**

```ts
declare const TestEventDeliveryAttempt: TestEventDeliveryAttempt;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L63)

### TestEventFake

**Signature**

```ts
declare const TestEventFake: TestEventFake<Payload, Output>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L64)

### TestEventOptions

**Signature**

```ts
declare const TestEventOptions: TestEventOptions<Payload, Output>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L65)

### TestEventPublishResult

**Signature**

```ts
declare const TestEventPublishResult: TestEventPublishResult;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L66)

### TestEventTriggerOptions

**Signature**

```ts
declare const TestEventTriggerOptions: TestEventTriggerOptions<Output>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L67)

### TestFailureControls

**Signature**

```ts
declare const TestFailureControls: TestFailureControls;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L20)

### TestFakes

**Signature**

```ts
declare const TestFakes: TestFakes;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L20)

### TestFakesOptions

**Signature**

```ts
declare const TestFakesOptions: TestFakesOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L20)

### TestHttpApplication

**Signature**

```ts
declare const TestHttpApplication: TestHttpApplication;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L41)

### TestHttpClient

**Signature**

```ts
declare const TestHttpClient: TestHttpClient;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L42)

### TestHttpClientOptions

**Signature**

```ts
declare const TestHttpClientOptions: TestHttpClientOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L43)

### TestHttpInput

**Signature**

```ts
declare const TestHttpInput: TestHttpInput;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L44)

### TestHttpListener

**Signature**

```ts
declare const TestHttpListener: TestHttpListener;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L45)

### TestHttpListenerOptions

**Signature**

```ts
declare const TestHttpListenerOptions: TestHttpListenerOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L46)

### TestHttpRequest

**Signature**

```ts
declare const TestHttpRequest: TestHttpRequest;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L47)

### TestJobCloseOptions

**Signature**

```ts
declare const TestJobCloseOptions: TestJobCloseOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L51)

### TestJobFake

**Signature**

```ts
declare const TestJobFake: TestJobFake<Input, Output>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L51)

### TestJobOptions

**Signature**

```ts
declare const TestJobOptions: TestJobOptions<Input, Output>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L51)

### TestJobsAdapter

**Signature**

```ts
declare const TestJobsAdapter: TestJobsAdapter;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L53)

### TestJobsAdapterOptions

**Signature**

```ts
declare const TestJobsAdapterOptions: TestJobsAdapterOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L53)

### TestObservability

**Signature**

```ts
declare const TestObservability: TestObservability;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L48)

### TestProviderReplacements

**Signature**

```ts
declare const TestProviderReplacements: Readonly<
  Partial<
    Record<
      "bucket" | "cache" | "job" | "event" | "model" | "realtime" | "agent-state",
      Readonly<Record<string, unknown>>
    >
  >
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L21)

### TestRuntime

**Signature**

```ts
declare const TestRuntime: TestRuntime;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L13)

### TestRuntimeCloseOptions

**Signature**

```ts
declare const TestRuntimeCloseOptions: TestRuntimeCloseOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L14)

### TestRuntimeOptions

**Signature**

```ts
declare const TestRuntimeOptions: TestRuntimeOptions<S>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L15)

### assertObservabilityHookTypes

**Signature**

```ts
declare const assertObservabilityHookTypes: (
  hooks: Pick<InspectableObservabilityHooks, "read">,
  expected: readonly ObservabilityHookEvent["type"][],
) => readonly ObservabilityHookEvent[];
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L28)

### assertResponseStatus

**Signature**

```ts
declare const assertResponseStatus: (response: Response, expected: number) => Response;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L29)

### createBunHttpListener

**Signature**

```ts
declare const createBunHttpListener: (
  app: TestHttpApplication,
  options?: TestHttpListenerOptions,
) => Promise<TestHttpListener>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L30)

### createDeterministicJobsAdapter

**Signature**

```ts
declare const createDeterministicJobsAdapter: (options?: TestJobsAdapterOptions) => TestJobsAdapter;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L52)

### createHttpTestClient

**Signature**

```ts
declare const createHttpTestClient: (
  app: TestHttpApplication,
  options?: TestHttpClientOptions,
) => TestHttpClient;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L31)

### createJobsConformanceHarness

**Signature**

```ts
declare const createJobsConformanceHarness: (
  options?: TestJobsAdapterOptions,
) => JobsConformanceHarness;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L55)

### createObservabilityAssertions

**Signature**

```ts
declare const createObservabilityAssertions: () => TestObservability;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L32)

### createTestAgentStateProvider

**Signature**

```ts
declare const createTestAgentStateProvider: (root: string) => AgentStateProvider;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L22)

### createTestApplication

**Signature**

```ts
declare const createTestApplication: (
  app: { readonly env: object },
  options?: TestApplicationOptions,
) => Promise<TestApplication>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L17)

### createTestBucket

**Signature**

```ts
declare const createTestBucket: (options?: TestBucketFakeOptions) => TestBucketFake;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L23)

### createTestBucketFake

**Signature**

```ts
declare const createTestBucketFake: (options?: TestBucketFakeOptions) => TestBucketFake;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L23)

### createTestCache

**Signature**

```ts
declare const createTestCache: <
  const KeySchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
  const ValueSchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
>(
  options?: TestCacheFakeOptions<KeySchema, ValueSchema>,
) => TestCacheFake<InferInput<KeySchema>, InferOutput<ValueSchema>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L25)

### createTestCacheFake

**Signature**

```ts
declare const createTestCacheFake: <
  const KeySchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
  const ValueSchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
>(
  options?: TestCacheFakeOptions<KeySchema, ValueSchema>,
) => TestCacheFake<InferInput<KeySchema>, InferOutput<ValueSchema>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L25)

### createTestEvent

**Signature**

```ts
declare const createTestEvent: <Payload = unknown, Output = unknown>(
  options: TestEventOptions<Payload, Output>,
) => Promise<TestEventFake<Payload, Output>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L60)

### createTestEventFake

**Signature**

```ts
declare const createTestEventFake: <Payload = unknown, Output = unknown>(
  options: TestEventOptions<Payload, Output>,
) => Promise<TestEventFake<Payload, Output>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L60)

### createTestFakes

**Signature**

```ts
declare const createTestFakes: (stateRoot: string, options?: TestFakesOptions) => TestFakes;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L19)

### createTestHttpClient

**Signature**

```ts
declare const createTestHttpClient: (
  app: TestHttpApplication,
  options?: TestHttpClientOptions,
) => TestHttpClient;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L33)

### createTestHttpListener

**Signature**

```ts
declare const createTestHttpListener: (
  app: TestHttpApplication,
  options?: TestHttpListenerOptions,
) => Promise<TestHttpListener>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L34)

### createTestJob

**Signature**

```ts
declare const createTestJob: <Input = JsonValue, Output = unknown>(
  options: TestJobOptions<Input, Output>,
) => Promise<TestJobFake<Input, Output>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L50)

### createTestJobFake

**Signature**

```ts
declare const createTestJobFake: <Input = JsonValue, Output = unknown>(
  options: TestJobOptions<Input, Output>,
) => Promise<TestJobFake<Input, Output>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L50)

### createTestJobsAdapter

**Signature**

```ts
declare const createTestJobsAdapter: (options?: TestJobsAdapterOptions) => TestJobsAdapter;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L52)

### createTestObservability

**Signature**

```ts
declare const createTestObservability: () => TestObservability;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L35)

### createTestRealtimeProvider

**Signature**

```ts
declare const createTestRealtimeProvider: (root: string) => RealtimeProvider;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L22)

### createTestRuntime

**Signature**

```ts
declare const createTestRuntime: <S extends EnvShape = EnvShape>(
  options?: TestRuntimeOptions<S>,
) => TestRuntime;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L10)

### invokeFunction

**Signature**

```ts
declare const invokeFunction: <
  const Target extends StandaloneFunctionTarget,
  Context extends { readonly signal: AbortSignal } = FunctionContextOf<Target>,
>(
  target: Target,
  input: FunctionInput<Target>,
  options?: InvokeFunctionOptions<Context>,
) => Promise<FunctionOutput<Target>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L2)

### responseJson

**Signature**

```ts
declare const responseJson: <T = unknown>(
  response: Response,
  expectedStatus?: number,
) => Promise<T>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L36)

### responseText

**Signature**

```ts
declare const responseText: (response: Response, expectedStatus?: number) => Promise<string>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L37)

### runJobsConformance

**Signature**

```ts
declare const runJobsConformance: (
  adapter: JobsAdapterRuntime,
  fixtureIds?: readonly string[],
) => Promise<readonly string[]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L56)

## `invoke-function.ts`

### invokeFunction

Invokes a function descriptor through the engine's direct, transport-free path.

**Example**

```ts
import { defineFunction } from "@relkit/app/functions";
import { z } from "@relkit/app/schema";
import { invokeFunction } from "@relkit/testing";

export async function greetingExample(): Promise<string> {
  const greet = defineFunction({
    id: "greet",
    input: z.string(),
    output: z.string(),
    handler: async (name) => `Hello ${name}`,
  });
  return invokeFunction(greet, "Ada");
}
```

**Signature**

```ts
declare const invokeFunction: <
  const Target extends StandaloneFunctionTarget,
  Context extends { readonly signal: AbortSignal } = FunctionContextOf<Target>,
>(
  target: Target,
  input: FunctionInput<Target>,
  options?: InvokeFunctionOptions<Context>,
) => Promise<FunctionOutput<Target>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.ts#L52)

Since v0.1.0

### FunctionContextOf

**Signature**

```ts
declare const FunctionContextOf: FunctionContextOf<Target>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.ts#L12)

### FunctionInput

**Signature**

```ts
declare const FunctionInput: FunctionInput<Target>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.ts#L10)

### FunctionOutput

**Signature**

```ts
declare const FunctionOutput: FunctionOutput<Target>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.ts#L11)

### InvokeFunctionOptions

**Signature**

```ts
declare const InvokeFunctionOptions: InvokeFunctionOptions<Context>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.ts#L13)

### StandaloneFunctionTarget

**Signature**

```ts
declare const StandaloneFunctionTarget: StandaloneFunctionTarget;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.ts#L9)

### invokeFunctionWithRunner

Invokes the existing engine validation path with an explicit Effect runner.

**Signature**

```ts
declare const invokeFunctionWithRunner: <
  const Target extends StandaloneFunctionTarget,
  Context extends { readonly signal: AbortSignal } = FunctionContextOf<Target>,
>(
  target: Target,
  input: FunctionInput<Target>,
  options: InvokeFunctionOptions<Context> | undefined,
  runner?: InvocationRunner,
) => Promise<FunctionOutput<Target>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.ts#L107)

## `invoke-function.types.ts`

### FunctionContextOf (type alias)

Context inferred from the native handler, preserving required cancellation.

**Signature**

```ts
type FunctionContextOf<Target> =
  Target extends Record<"handler", (input: infer _Input, context: infer Context) => unknown>
    ? Context extends { readonly signal: AbortSignal }
      ? Context
      : InvocationContext
    : InvocationContext;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L45)

### FunctionInput (type alias)

Input inferred from the target's native schema authority.

**Signature**

```ts
type FunctionInput<Target extends { readonly input: StandardSchemaV1 }> = InferInput<
  Target["input"]
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L29)

### FunctionOutput (type alias)

Output inferred from the target's native schema authority.

**Signature**

```ts
type FunctionOutput<Target extends { readonly output: StandardSchemaV1 }> = InferOutput<
  Target["output"]
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L37)

### InvokeFunctionOptions (interface)

Direct invocation dependencies and native hooks without process environment reads.

**Signature**

```ts
export interface InvokeFunctionOptions<Context extends { readonly signal: AbortSignal }> {
  readonly registry?: FunctionRegistry;
  readonly env?: Readonly<Record<string, unknown>>;
  readonly clients?: DependencyClientSources;
  readonly signal?: AbortSignal;
  readonly now?: () => number;
  readonly idSource?: InvocationIdSource;
  readonly context?: InvocationHooks<Context>["context"];
  readonly hooks?: InvocationHooks<Context>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L56)

### StandaloneFunctionTarget (interface)

Native function descriptor retaining input, output and dependency validation.

**Signature**

```ts
export interface StandaloneFunctionTarget {
  readonly id: string;
  readonly input: StandardSchemaV1;
  readonly output: StandardSchemaV1;
  readonly errors?: readonly { readonly id: string; readonly data: StandardSchemaV1 }[];
  readonly dependencies?: import("@relkit/engine").DependencyDeclarations;
  readonly publishes?: readonly string[];
  readonly publications?: Readonly<Record<string, import("@relkit/engine").DependencyRefLike>>;
  readonly timeoutMs?: number;
  readonly concurrency?: number;
  readonly handler: (...arguments_: readonly never[]) => MaybePromise<unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L12)

## `job-harness.types.ts`

### JobHarnessService (interface)

Native inspection and Effect workflows over one durable job generation.

**Signature**

```ts
export interface JobHarnessService {
  readonly value: TestJobFake<never, unknown>;
  readonly runNext: (
    id?: string,
  ) => Effect.Effect<Awaited<ReturnType<TestJobFake["runNext"]>>, unknown>;
  readonly drain: Effect.Effect<Awaited<ReturnType<TestJobFake["drain"]>>, unknown>;
  readonly restart: Effect.Effect<void, unknown>;
  readonly close: (options?: TestJobCloseOptions) => Effect.Effect<void, unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/job-harness.types.ts#L5)

## `job-runtime-controls.ts`

### enqueueJob

Persists one submission before making a new durable instance available.

**Signature**

```ts
declare const enqueueJob: (
  queue: JobQueue,
  input: JobQueueEnqueue,
  signal: AbortSignal,
) => Effect.Effect<JobQueueAcceptance, unknown, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/job-runtime-controls.ts#L13)

### jobWorkerControls

Composes native worker selection and retry promotion against the current generation.

**Signature**

```ts
declare const jobWorkerControls: (state: JobWorkerState) => {
  runNext: (
    instanceId?: string | undefined,
  ) => Effect.Effect<JobRunResult | undefined, unknown, never>;
  drain: Effect.Effect<ReadonlyArray<JobRunResult>, unknown, never>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/job-runtime-controls.ts#L67)

### promoteDueJobs

Promotes due entries in native snapshot order before worker admission.

**Signature**

```ts
declare const promoteDueJobs: (
  queue: JobQueue,
  currentTimeMs: () => number,
) => Effect.Effect<void, unknown, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/job-runtime-controls.ts#L37)

## `job-runtime.ts`

### createTestJobRuntime

Acquires and composes the durable job owner's actual workflows.

**Signature**

```ts
declare const createTestJobRuntime: <Input = JsonValue, Output = unknown>(
  options: TestJobOptions<Input, Output>,
) => Effect.Effect<
  {
    value: JobHarnessService["value"];
    runNext: (instanceId?: string) => Effect.Effect<JobRunResult | undefined, unknown, never>;
    drain: Effect.Effect<ReadonlyArray<JobRunResult>, unknown, never>;
    restart: Effect.Effect<void, unknown, never>;
    close: (closeOptions: TestJobCloseOptions | undefined) => Effect.Effect<void, unknown, never>;
  },
  unknown,
  Scope.Scope
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/job-runtime.ts#L38)

## `job-runtime.types.ts`

### JobRuntimeState (interface)

Admission, native cancellation and actual completion receipts for one durable job owner.

**Signature**

```ts
export interface JobRuntimeState extends WorkOwnershipState {}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/job-runtime.types.ts#L6)

### JobWorkerState (interface)

Current-generation native authorities read lazily by ordered worker workflows.

**Signature**

```ts
export interface JobWorkerState {
  readonly queue: () => JobQueue;
  readonly worker: () => Awaited<ReturnType<typeof materializeJobs>>;
  readonly jobId: string;
  readonly now: () => number;
  readonly isClosed: () => boolean;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/job-runtime.types.ts#L9)

## `jobs-conformance.ts`

### JOBS_CONFORMANCE_FIXTURES

**Signature**

```ts
declare const JOBS_CONFORMANCE_FIXTURES: ReadonlyArray<JobsConformanceFixture>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.ts#L10)

### JobsConformanceFixture

**Signature**

```ts
declare const JobsConformanceFixture: JobsConformanceFixture;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.ts#L2)

### JobsConformanceHarness

**Signature**

```ts
declare const JobsConformanceHarness: JobsConformanceHarness;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.ts#L2)

### createJobsConformanceHarness

Creates the deterministic adapter used by native contract fixtures.

**Signature**

```ts
declare const createJobsConformanceHarness: (
  options?: TestJobsAdapterOptions,
) => JobsConformanceHarness;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.ts#L33)

### runJobsConformance

Executes selected existing native adapter contract fixtures sequentially.

**Signature**

```ts
declare const runJobsConformance: (
  adapter: JobsAdapterRuntime,
  fixtureIds?: readonly string[],
) => Promise<readonly string[]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.ts#L59)

## `jobs-conformance.types.ts`

### JobsConformanceFixture (interface)

Native adapter fixture inputs for reusable jobs contract assertions.

**Signature**

```ts
export interface JobsConformanceFixture {
  readonly id: string;
  readonly description: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.types.ts#L7)

### JobsConformanceHarness (interface)

Owned native jobs conformance operations and completion controls.

**Signature**

```ts
export interface JobsConformanceHarness {
  readonly adapter: TestJobsAdapter;
  readonly context: OperationContext;
  readonly fixtures: typeof JOBS_CONFORMANCE_FIXTURES;
  readonly run: (fixtureId: string) => Promise<RunHandle | undefined>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.types.ts#L13)

## `jobs-types.ts`

Preserved compatibility entrypoint for the canonical domain type companion.

### "./jobs.types.js" (namespace export)

Re-exports all named exports from the "./jobs.types.js" module.

**Signature**

```ts
export * from "./jobs.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-types.ts#L2)

## `jobs-utils.ts`

### createFailures

Creates isolated named failure injection controls.

**Signature**

```ts
declare const createFailures: () => TestFailureControls;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-utils.ts#L170)

### createIdSource

Creates an isolated monotonically sequenced invocation identity source.

**Signature**

```ts
declare const createIdSource: () => InvocationIdSource;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-utils.ts#L142)

### createJobInvoker

Binds job invocation to deterministic IDs, time and owner cancellation.

**Signature**

```ts
declare const createJobInvoker: <Input, Output>(
  target: InvocationTarget<Input, Output>,
  failures: TestFailureControls,
  runner: InvocationRunner,
  idSource: InvocationIdSource,
  now: () => number,
  env: Readonly<Record<string, unknown>> | undefined,
  clients: DependencyClientSources | undefined,
  hooks: InvocationHooks | undefined,
  ownerSignal?: () => AbortSignal,
) => (request: JobInvocationOptions) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-utils.ts#L86)

### createPlan

Builds the minimal registration plan consumed by native materialization.

**Signature**

```ts
declare const createPlan: <Input, Output>(
  jobId: string,
  target: InvocationTarget<Input, Output>,
  retry: RetryPolicy,
  profile: string,
  options: TestJobOptions<Input, Output>,
) => Parameters<typeof materializeJobs>[0]["plan"];
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-utils.ts#L38)

### createRandom

Creates deterministic retry randomness with upfront fixture validation.

**Signature**

```ts
declare const createRandom: (
  source: (() => number) | undefined,
  values: readonly number[] | undefined,
) => () => number;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-utils.ts#L152)

### defaultRetry

**Signature**

```ts
declare const defaultRetry: RetryPolicy;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-utils.ts#L19)

## `jobs.ts`

### TestJobHarness (class)

Durable native job generation owned by one test scope.

**Signature**

```ts
declare class TestJobHarness
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs.ts#L10)

### createTestJob

**Signature**

```ts
declare const createTestJob: <Input = JsonValue, Output = unknown>(
  options: TestJobOptions<Input, Output>,
) => Promise<TestJobFake<Input, Output>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs.ts#L92)

### createTestJobFake

Creates a durable one-job harness with an owned Effect runtime.

**Signature**

```ts
declare const createTestJobFake: <Input = JsonValue, Output = unknown>(
  options: TestJobOptions<Input, Output>,
) => Promise<TestJobFake<Input, Output>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs.ts#L52)

### testJobLayer

Acquires native store/queue/worker resources with deterministic retry inputs.

**Signature**

```ts
declare const testJobLayer: <Input, Output>(
  options: TestJobOptions<Input, Output>,
) => Layer.Layer<TestJobHarness, unknown, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs.ts#L21)

## `jobs.types.ts`

### TestJobCloseOptions (interface)

Explicit failed-test state retention policy for durable job shutdown.

**Signature**

```ts
export interface TestJobCloseOptions {
  readonly failed?: boolean;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs.types.ts#L46)

### TestJobFake (interface)

Owned durable native job facade with deterministic admission and lifecycle controls.

**Signature**

```ts
export interface TestJobFake<Input = JsonValue, Output = unknown> extends JobClient<Input> {
  readonly id: string;
  readonly client: JobClient<Input>;
  readonly provider: JobProvider;
  readonly stateRoot: string;
  readonly clock: TestClock;
  readonly random: () => number;
  readonly failures: TestFailureControls;
  readonly admin: JobAdmin;
  readonly status: () => JobQueueCounts;
  readonly get: (instanceId: string) => JobQueueEntry | undefined;
  readonly runNext: (instanceId?: string) => Promise<JobRunResult | undefined>;
  readonly drain: () => Promise<readonly JobRunResult[]>;
  readonly restart: () => Promise<void>;
  readonly close: (options?: TestJobCloseOptions) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs.types.ts#L55)

### TestJobOptions (interface)

Durable native target, retry bounds and deterministic persistence dependencies.

**Signature**

```ts
export interface TestJobOptions<Input = JsonValue, Output = unknown> {
  readonly logger?: import("@relkit/runtime-effect").LoggerOptions;
  readonly jobId?: string;
  readonly target: InvocationTarget<Input, Output>;
  readonly retry?: RetryPolicy;
  readonly profile?: string;
  readonly timeoutMs?: number;
  readonly concurrency?: number;
  readonly consumerConcurrency?: number;
  readonly idempotency?: JobIdempotencyDefinition;
  readonly leaseDurationMs?: number;
  readonly ownerId?: string;
  readonly stateRoot?: string;
  readonly startTimeMs?: number;
  readonly random?: () => number;
  readonly randomValues?: readonly number[];
  readonly failures?: TestFailureControls;
  readonly env?: Readonly<Record<string, unknown>>;
  readonly clients?: DependencyClientSources;
  readonly hooks?: InvocationHooks;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs.types.ts#L23)

## `native-jobs-observe.ts`

### nativeJobObservation

Publishes owner state availability without polling or sharing observer cursors.

**Signature**

```ts
declare const nativeJobObservation: (
  state: Ref.Ref<NativeJobsState>,
  clock: TestClock,
  service: string,
  request: NativeWatchRequest,
  context: OperationContext,
) => Stream.Stream<
  | {
      readonly kind: "snapshot";
      readonly run: RunSnapshot;
      readonly observedAt: string;
      readonly epoch: string;
      readonly sequence: number;
      readonly cursor?: string;
      readonly continuity: "state" | "history";
    }
  | {
      readonly kind: "update";
      readonly run: RunSnapshot;
      readonly observedAt: string;
      readonly epoch: string;
      readonly sequence: number;
      readonly cursor?: string;
    },
  unknown,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/native-jobs-observe.ts#L19)

## `native-jobs-service.ts`

### TestNativeJobs (class)

Owns authoritative native run state, deterministic time and observation synchronization.

**Signature**

```ts
declare class TestNativeJobs
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/native-jobs-service.ts#L15)

### nativeJobsLayer

Builds one native jobs service, substitutable by providing TestNativeJobs.of in tests.

**Signature**

```ts
declare const nativeJobsLayer: (
  options?: TestJobsAdapterOptions,
) => Layer.Layer<TestNativeJobs, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/native-jobs-service.ts#L24)

## `native-jobs-state.ts`

### notifyNativeJobs

Publishes state availability without buffers or wall-clock polling.

**Signature**

```ts
declare const notifyNativeJobs: (value: NativeJobsState) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/native-jobs-state.ts#L9)

## `native-jobs.types.ts`

### NativeJobsService (interface)

Effect native jobs adapter decisions with owned worker and observation lifetimes.

**Signature**

```ts
export interface NativeJobsService {
  readonly state: Ref.Ref<NativeJobsState>;
  readonly clock: TestClock;
  readonly submit: (
    ...args: Parameters<JobsAdapterRuntime["submit"]>
  ) => Effect.Effect<Awaited<ReturnType<JobsAdapterRuntime["submit"]>>, unknown>;
  readonly get: (
    ...args: Parameters<JobsAdapterRuntime["get"]>
  ) => Effect.Effect<RunSnapshot, unknown>;
  readonly list: (
    ...args: Parameters<JobsAdapterRuntime["list"]>
  ) => Effect.Effect<Awaited<ReturnType<JobsAdapterRuntime["list"]>>, unknown>;
  readonly cancel: (
    ...args: Parameters<JobsAdapterRuntime["cancel"]>
  ) => Effect.Effect<Awaited<ReturnType<JobsAdapterRuntime["cancel"]>>, unknown>;
  readonly retry: (
    ...args: Parameters<NonNullable<JobsAdapterRuntime["retry"]>>
  ) => Effect.Effect<Awaited<ReturnType<NonNullable<JobsAdapterRuntime["retry"]>>>, unknown>;
  readonly worker: {
    readonly next: (
      ...args: Parameters<NonNullable<JobsAdapterRuntime["worker"]>["next"]>
    ) => Effect.Effect<
      Awaited<ReturnType<NonNullable<JobsAdapterRuntime["worker"]>["next"]>>,
      unknown
    >;
    readonly complete: (
      ...args: Parameters<NonNullable<JobsAdapterRuntime["worker"]>["complete"]>
    ) => Effect.Effect<void, unknown>;
    readonly fail: (
      ...args: Parameters<NonNullable<JobsAdapterRuntime["worker"]>["fail"]>
    ) => Effect.Effect<void, unknown>;
  };
  readonly observe: (
    ...args: Parameters<NonNullable<JobsAdapterRuntime["observe"]>>
  ) => Stream.Stream<RunWatchFrame<RunSnapshot>, unknown>;
  readonly snapshot: (runId: string) => Effect.Effect<RunSnapshot, unknown>;
  readonly close: Effect.Effect<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/native-jobs.types.ts#L22)

### NativeJobsState (interface)

Owner-local deterministic run, worker, cursor and observation admission state.

**Signature**

```ts
export interface NativeJobsState {
  readonly runs: Map<string, TestNativeRun>;
  readonly keys: Map<string, string>;
  readonly cancelReceipts: Map<string, Awaited<ReturnType<JobsAdapterRuntime["cancel"]>>>;
  readonly retryReceipts: Map<
    string,
    Awaited<ReturnType<NonNullable<JobsAdapterRuntime["retry"]>>>
  >;
  sequence: number;
  closed: boolean;
  changed: Deferred.Deferred<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/native-jobs.types.ts#L8)

## `provider-replacements.ts`

### TestProviderReplacements

**Signature**

```ts
declare const TestProviderReplacements: Readonly<
  Partial<
    Record<
      "bucket" | "cache" | "job" | "event" | "model" | "realtime" | "agent-state",
      Readonly<Record<string, unknown>>
    >
  >
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/provider-replacements.ts#L2)

### activateTestProviders

Acquires native providers and wires dependency clients with partial-failure release.

**Signature**

```ts
declare const activateTestProviders: (
  artifacts: TestApplicationArtifacts | undefined,
  replacements: TestProviderReplacements,
  bindingValues: Readonly<Record<string, JsonValue>> | undefined,
  fakes: TestFakes,
  fakeResources?: boolean,
) => Promise<ProviderRegistry | undefined>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/provider-replacements.ts#L49)

### copyTestProviderReplacements

Copies explicit capability/profile replacements before resource acquisition.

**Signature**

```ts
declare const copyTestProviderReplacements: (
  input: TestProviderReplacements | undefined,
) => TestProviderReplacements;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/provider-replacements.ts#L20)

## `provider-replacements.types.ts`

### TestProviderReplacements (type alias)

Explicit capability/profile replacements; absent profiles remain native authority decisions.

**Signature**

```ts
type TestProviderReplacements = Readonly<
  Partial<Record<ProviderCapability, Readonly<Record<string, unknown>>>>
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/provider-replacements.types.ts#L4)

## `runtime-clock.ts`

### TestDeterministicClock (class)

Manual time and native clock scheduling belong to one deterministic owner.

**Signature**

```ts
declare class TestDeterministicClock
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-clock.ts#L137)

### combineSignals

Combines cancellation sources without retaining their listeners after work.

**Signature**

```ts
declare const combineSignals: (...signals: (AbortSignal | undefined)[]) => CombinedSignals;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-clock.ts#L117)

### createDeterministicClock

Creates a manually controlled native Effect clock without wall-time polling.

**Signature**

```ts
declare const createDeterministicClock: (startTime: number) => DeterministicClockService;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-clock.ts#L13)

### deterministicClockLayer

Provides a replaceable clock service from the native manual-time implementation.

**Signature**

```ts
declare const deterministicClockLayer: (
  startTime?: number,
) => Layer.Layer<TestDeterministicClock, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-clock.ts#L147)

## `runtime-clock.types.ts`

### ClockWaiter (interface)

Owned deterministic deadline and its native completion callback.

**Signature**

```ts
export interface ClockWaiter {
  readonly at: number;
  readonly resume: (effect: Effect.Effect<void>) => void;
  done: boolean;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-clock.types.ts#L6)

### CombinedSignals (interface)

Native cancellation signal and the explicit lifetime of its source listeners.

**Signature**

```ts
export interface CombinedSignals {
  readonly signal: AbortSignal;
  readonly dispose: () => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-clock.types.ts#L20)

### DeterministicClockService (interface)

Manually controlled native clock with an Effect invocation runner.

**Signature**

```ts
export interface DeterministicClockService {
  readonly service: Clock.Clock;
  readonly clock: TestClock;
  readonly run: InvocationRunner["run"];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-clock.types.ts#L13)

## `runtime-close.ts`

### closeRuntime

Waits for bounded admitted work before cleaning temporary ownership.

**Signature**

```ts
declare const closeRuntime: (
  pending: Set<Promise<unknown>>,
  timeoutMs: number,
  cleanup: (failed: boolean) => Effect.Effect<void, unknown>,
  failed: () => boolean,
) => Effect.Effect<void, unknown, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-close.ts#L11)

## `runtime-context.ts`

### createTestContextFactory

Creates the validated runtime context defaults with an explicit caller patch.

**Signature**

```ts
declare const createTestContextFactory: (patch: Readonly<Record<string, unknown>>) => ({
  invocation,
  signal,
  env,
  time,
}: InvocationContextOptions) => Readonly<{
  invocation: InvocationRecord;
  signal: AbortSignal;
  env: Readonly<Record<string, unknown>>;
  time: PublicClock;
  log: Readonly<{
    trace: () => void;
    debug: () => void;
    info: () => void;
    warn: () => void;
    error: () => void;
  }>;
  jobs: Readonly<{}>;
  events: Readonly<{}>;
  buckets: Readonly<{}>;
  cache: Readonly<{}>;
  agents: Readonly<{}>;
  database: Readonly<{}>;
  auth: Readonly<{ getSession: () => Promise<null> }>;
  constants: Readonly<{}>;
  prompts: Readonly<{}>;
}>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-context.ts#L12)

## `runtime-execution.ts`

### TestRuntimeExecution (class)

Owns invocation admission, cancellation, deterministic dependencies and shutdown.

**Signature**

```ts
declare class TestRuntimeExecution
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-execution.ts#L30)

### testRuntimeLayer

Allocates a synchronously ready runtime domain service after validating all options.

**Signature**

```ts
declare const testRuntimeLayer: <S extends EnvShape = EnvShape>(
  options?: TestRuntimeOptions<S>,
) => Layer.Layer<TestRuntimeExecution, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-execution.ts#L41)

## `runtime-execution.types.ts`

### RuntimeExecutionService (interface)

Effect invocation admission and shutdown with deterministic native runtime state.

**Signature**

```ts
export interface RuntimeExecutionService {
  readonly value: Omit<TestRuntime, "invoke" | "close">;
  readonly invoke: <Target extends StandaloneFunctionTarget>(
    target: Target,
    input: FunctionInput<Target>,
    options?: Omit<InvokeFunctionOptions<FunctionContextOf<Target>>, "env" | "now" | "idSource">,
  ) => Effect.Effect<FunctionOutput<Target>, unknown>;
  readonly close: (options?: TestRuntimeCloseOptions) => Effect.Effect<void, unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-execution.types.ts#L12)

## `runtime-options.ts`

### resolveRuntimeEnv

Resolves explicit values through the application's existing environment authority.

**Signature**

```ts
declare const resolveRuntimeEnv: <S extends EnvShape>(
  options: TestRuntimeOptions<S>,
) => Readonly<Record<string, unknown>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-options.ts#L10)

### validateRuntimeTimeout

Rejects invalid close deadlines before allocating native resources.

**Signature**

```ts
declare const validateRuntimeTimeout: (value: number) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-options.ts#L63)

## `runtime.ts`

### TestClock

**Signature**

```ts
declare const TestClock: TestClock;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.ts#L10)

### TestRuntime

**Signature**

```ts
declare const TestRuntime: TestRuntime;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.ts#L11)

### TestRuntimeCloseOptions

**Signature**

```ts
declare const TestRuntimeCloseOptions: TestRuntimeCloseOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.ts#L9)

### TestRuntimeOptions

**Signature**

```ts
declare const TestRuntimeOptions: TestRuntimeOptions<S>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.ts#L8)

### createTestRuntime

Creates a small deterministic runtime for direct function tests.

**Example**

```ts
import { defineEnv } from "@relkit/app/config";
import { createTestRuntime } from "@relkit/testing";

export async function runtimeExample(): Promise<void> {
  const runtime = createTestRuntime({ app: { env: defineEnv({}) } });
  try {
    await runtime.clock.advance(10);
  } finally {
    await runtime.close();
  }
}
```

**See**

- tests/fixtures/checked-examples.ts ownedHelpersExample for checked inference and release.

**Signature**

```ts
declare const createTestRuntime: <S extends EnvShape = EnvShape>(
  options?: TestRuntimeOptions<S>,
) => TestRuntime;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.ts#L41)

## `runtime.types.ts`

### TestClock (interface)

Deterministic native time facade advanced only by explicit test commands.

**Signature**

```ts
export interface TestClock {
  readonly now: () => Date;
  readonly currentTimeMs: () => number;
  readonly advance: (milliseconds: number) => Promise<void>;
  readonly setTime: (timestamp: number) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L37)

### TestRuntime (interface)

Owned direct invocation runtime with native dependency fakes and complete shutdown.

**Signature**

```ts
export interface TestRuntime {
  readonly stateRoot: string;
  readonly fakes: TestFakes;
  readonly providers: TestProviderReplacements;
  readonly env: Readonly<Record<string, unknown>>;
  readonly clock: TestClock;
  readonly invoke: <Target extends StandaloneFunctionTarget>(
    target: Target,
    input: FunctionInput<Target>,
    options?: Omit<InvokeFunctionOptions<FunctionContextOf<Target>>, "env" | "now" | "idSource">,
  ) => Promise<FunctionOutput<Target>>;
  readonly close: (options?: TestRuntimeCloseOptions) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L45)

### TestRuntimeCloseOptions (interface)

Explicit failed-test state retention policy for runtime shutdown.

**Signature**

```ts
export interface TestRuntimeCloseOptions {
  readonly failed?: boolean;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L32)

### TestRuntimeOptions (interface)

Runtime options retaining the concrete application's environment shape.

**Signature**

```ts
export interface TestRuntimeOptions<S extends EnvShape = EnvShape> {
  readonly registry?: FunctionRegistry;
  readonly logger?: LoggerOptions;
  readonly app?: { readonly env: EnvDefinition<S> };
  readonly environment?: string;
  readonly env?: Readonly<Record<string, unknown>>;
  readonly startTimeMs?: number;
  readonly closeTimeoutMs?: number;
  readonly context?: Readonly<Record<string, unknown>>;
  readonly providers?: TestProviderReplacements;
  /** Caller-owned roots enable explicit restart tests; omitted roots are temporary. */
  readonly stateRoot?: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L17)

## `state-providers.ts`

Supplies local realtime and agent-state providers without selecting a native agent engine.

### createTestAgentStateProvider

Constructs the native local agent state provider at an explicit test root.

**Signature**

```ts
declare const createTestAgentStateProvider: (root: string) => AgentStateProvider;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/state-providers.ts#L23)

### createTestRealtimeProvider

Constructs the native local realtime provider at an explicit test root.

**Signature**

```ts
declare const createTestRealtimeProvider: (root: string) => RealtimeProvider;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/state-providers.ts#L14)

## `state-root.ts`

### TestStateRoot

**Signature**

```ts
declare const TestStateRoot: TestStateRoot;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/state-root.ts#L2)

### createTestStateRoot

Creates an owned temporary state root, or opens a caller-owned restart root.

**Signature**

```ts
declare const createTestStateRoot: (requestedPath?: string) => TestStateRoot;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/state-root.ts#L12)

## `state-root.types.ts`

Native temporary or caller-owned persistence path with idempotent cleanup.

### TestStateRoot (interface)

Native temporary or caller-owned persistence path with idempotent cleanup.

**Signature**

```ts
export interface TestStateRoot {
  readonly path: string;
  readonly cleanup: (failed: boolean) => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/state-root.types.ts#L2)

## `storage-failure.ts`

### InvalidTestSnapshot (class)

Typed invalid transfer boundary translated to the existing public TypeError family.

**Signature**

```ts
declare class InvalidTestSnapshot
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/storage-failure.ts#L4)

## `test-jobs-adapter-controls.ts`

### cancel

Applies the first native cancellation transition and acknowledgement receipt.

**Signature**

```ts
declare const cancel: (
  runs: Map<string, TestNativeRun>,
  receipts: Map<string, NativeControlReceipt>,
  request: NativeCancelRequest,
  unknownOutcome: boolean,
  service: string,
  clock: TestClock,
) => Promise<NativeControlReceipt>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-controls.ts#L25)

### retry

Creates a deduplicated native retry with a fresh canonical run identity.

**Signature**

```ts
declare const retry: (
  runs: Map<string, TestNativeRun>,
  receipts: Map<string, NativeControlReceipt>,
  request: NativeRetryRequest,
  unknownOutcome: boolean,
  service: string,
  clock: TestClock,
) => Promise<NativeControlReceipt>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-controls.ts#L72)

### unknown

Builds an explicit ambiguous native write result.

**Signature**

```ts
declare const unknown: (
  code: JobUnknownOutcome["code"],
  operationId: string,
  idempotencyKey?: string,
) => JobUnknownOutcome;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-controls.ts#L125)

## `test-jobs-adapter-support.ts`

### TestNativeRun

**Signature**

```ts
declare const TestNativeRun: TestNativeRun;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-support.ts#L2)

### detachedNativeSnapshot

Reads a detached native snapshot, including retained state after owner close.

**Signature**

```ts
declare const detachedNativeSnapshot: (
  state: NativeJobsState,
  runId: string,
  service: string,
  clock: TestClock,
) => RunSnapshot;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-support.ts#L17)

### failureOf

Projects an unknown worker failure into the existing public envelope.

**Signature**

```ts
declare const failureOf: (value: unknown) => JobErrorEnvelope;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-support.ts#L93)

### isTerminal

Classifies native job terminal lifecycle states.

**Signature**

```ts
declare const isTerminal: (status: RunSnapshot["status"]) => boolean;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-support.ts#L33)

### requestKey

Builds the existing canonical submission deduplication identity.

**Signature**

```ts
declare const requestKey: (request: NativeSubmission) => string | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-support.ts#L117)

### snapshotOf

Projects a native run using the injected observation clock.

**Signature**

```ts
declare const snapshotOf: (run: TestNativeRun, service: string, clock: TestClock) => RunSnapshot;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-support.ts#L49)

## `test-jobs-adapter-support.types.ts`

### TestNativeRun (interface)

Mutable deterministic native run state with owned worker cancellation.

**Signature**

```ts
export interface TestNativeRun {
  readonly request: NativeSubmission;
  readonly runId: string;
  readonly acceptedAt: string;
  status: RunSnapshot["status"];
  attempt: number;
  startedAt?: string;
  completedAt?: string;
  output?: unknown;
  error?: JobErrorEnvelope;
  retryOfRunId?: string;
  readonly canonicalInput: JobWireEnvelope;
  controller?: AbortController;
  disposeSignal?: () => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-support.types.ts#L5)

## `test-jobs-adapter-work.ts`

### complete

Commits a nonterminal worker's successful native outcome.

**Signature**

```ts
declare const complete: (
  run: TestNativeRun | undefined,
  output: unknown,
  clock: TestClock,
) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-work.ts#L163)

### createRun

Creates one queued native run using an injected acceptance clock.

**Signature**

```ts
declare const createRun: (
  request: NativeSubmission,
  runId: string,
  retryOfRunId: string | undefined,
  clock: TestClock,
) => TestNativeRun;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-work.ts#L27)

### fail

Commits a nonterminal worker's bounded native failure envelope.

**Signature**

```ts
declare const fail: (
  run: TestNativeRun | undefined,
  error: unknown,
  clock: TestClock,
) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-work.ts#L181)

### handle

Projects the accepted native run identity.

**Signature**

```ts
declare const handle: (run: TestNativeRun) => RunHandle;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-work.ts#L49)

### list

Filters native runs and returns detached deterministic snapshots.

**Signature**

```ts
declare const list: (
  runs: Map<string, TestNativeRun>,
  query: NativeRunQuery,
  service: string,
  clock: TestClock,
) => RunPage<RunSnapshot>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-work.ts#L68)

### next

Admits one queued native task and binds native cancellation.

**Signature**

```ts
declare const next: (
  runs: Map<string, TestNativeRun>,
  context: OperationContext,
  service: string,
  clock: TestClock,
) => Promise<NativeTaskWork | undefined>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-work.ts#L94)

## `test-jobs-adapter.ts`

### TestJobsAdapter

**Signature**

```ts
declare const TestJobsAdapter: TestJobsAdapter;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter.ts#L2)

### TestJobsAdapterOptions

**Signature**

```ts
declare const TestJobsAdapterOptions: TestJobsAdapterOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter.ts#L2)

### createDeterministicJobsAdapter

Creates a synchronous compatibility adapter over one deterministic jobs owner.

**Signature**

```ts
declare const createDeterministicJobsAdapter: (options?: TestJobsAdapterOptions) => TestJobsAdapter;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter.ts#L21)

### createTestJobsAdapter

**Signature**

```ts
declare const createTestJobsAdapter: (options?: TestJobsAdapterOptions) => TestJobsAdapter;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter.ts#L111)

## `test-jobs-adapter.types.ts`

### TestJobsAdapter (interface)

Owned native jobs adapter with deterministic worker and snapshot test controls.

**Signature**

```ts
export interface TestJobsAdapter extends JobsAdapterRuntime {
  readonly clock: TestClock;
  readonly runNext: () => Promise<import("@relkit/jobs/adapter").NativeTaskWork | undefined>;
  readonly snapshot: (runId: string) => RunSnapshot;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter.types.ts#L15)

### TestJobsAdapterOptions (interface)

Deterministic native adapter time, failure injection and unknown-outcome policy.

**Signature**

```ts
export interface TestJobsAdapterOptions {
  readonly logger?: import("@relkit/runtime-effect").LoggerOptions;
  readonly clock?: TestClock;
  readonly startTimeMs?: number;
  readonly service?: string;
  readonly unknown?: Partial<Record<"submit" | "cancel" | "retry", boolean>>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter.types.ts#L6)

## `testing-owner.ts`

### disposeTestingOwner

Releases an existing owner while retaining native failure identity.

**See**

- tests/fixtures/checked-examples.ts deterministicServicesExample for checked ownership.

**Signature**

```ts
declare const disposeTestingOwner: <R, E>(
  owner: ManagedRuntime.ManagedRuntime<R, E>,
) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/testing-owner.ts#L22)

### runRetainedTestingQuery

Reads retained, resource-free state using the owner's captured observation context.

**Signature**

```ts
declare const runRetainedTestingQuery: <A>(
  context: Context.Context<never>,
  query: Effect.Effect<A, unknown>,
) => Promise<A>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/testing-owner.ts#L36)

### testingLoggerLayer

Provisions redacting server logging once at a test helper's ownership boundary.

**See**

- tests/fixtures/checked-examples.ts deterministicServicesExample for checked provisioning.

**Signature**

```ts
declare const testingLoggerLayer: (options?: LoggerOptions) => Layer.Layer<never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/testing-owner.ts#L10)

## `work-ownership.ts`

### admitOwnedWork

Registers scoped work before restoring caller interruption at its join boundary.

**Signature**

```ts
declare const admitOwnedWork: <A>(
  state: WorkOwnershipState,
  scope: Scope.Scope,
  context: Context.Context<never>,
  work: Effect.Effect<A, unknown>,
) => Effect.Effect<A, unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/work-ownership.ts#L30)

### joinOwnedWork

Joins every actual completion while retaining failed operations as settled work.

**Signature**

```ts
declare const joinOwnedWork: (
  pending: Iterable<Promise<unknown>>,
) => Effect.Effect<void, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/work-ownership.ts#L56)

### ownedLifecycle

Owns restart and close ordering without replacing native persistence authorities.

**Signature**

```ts
declare const ownedLifecycle: (
  state: WorkOwnershipState,
  scope: Scope.Scope,
  context: Context.Context<never>,
  release: Effect.Effect<void, unknown>,
  acquire: Effect.Effect<void, unknown>,
  cleanup: (failed: boolean) => Effect.Effect<void>,
  closeOperation: OwnedCloseOperation,
) => {
  restart: Effect.Effect<void, unknown, never>;
  close: (failed?: boolean) => Effect.Effect<void, unknown, never>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/work-ownership.ts#L83)

### runOwnedContext

Runs a native facade callback in its already acquired observation context.

**Signature**

```ts
declare const runOwnedContext: <A>(
  context: Context.Context<never>,
  effect: Effect.Effect<A, unknown>,
) => Promise<A>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/work-ownership.ts#L12)

## `work-ownership.types.ts`

Native completion receipts and admission state shared by one scoped harness.

### OwnedCloseOperation (type alias)

Fixed release labels supplied only by the two declaration-owned durable harnesses.

**Signature**

```ts
type OwnedCloseOperation = "job.close" | "event.close";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/work-ownership.types.ts#L12)

### WorkOwnershipState (interface)

Native completion receipts and admission state shared by one scoped harness.

**Signature**

```ts
export interface WorkOwnershipState {
  readonly kind?: string;
  closed: boolean;
  controller: AbortController;
  pending: Set<Promise<unknown>>;
  restarting?: Promise<void>;
  closing?: Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/work-ownership.types.ts#L2)
