docs: document e2e helper mocks

This commit is contained in:
Peter Steinberger
2026-06-04 01:05:37 -04:00
parent ce1ef04efe
commit c768a9e6ca
2 changed files with 10 additions and 0 deletions
@@ -1,5 +1,8 @@
import { vi } from "vitest";
/**
* Fast mocks for embedded-runner E2E tests that do not need live plugin/runtime boot.
*/
type EmbeddedRunnerFastRunMockOptions = {
runEmbeddedAttempt: (params: unknown) => unknown;
prepareProviderRuntimeAuth?: (params: {
@@ -16,6 +19,7 @@ type EmbeddedRunnerBackoffMockOptions = {
sleepWithAbort: (ms: number, abortSignal?: AbortSignal) => unknown;
};
/** Installs baseline mocks for hook runner, context engine, and runtime plugin loading. */
export function installEmbeddedRunnerBaseE2eMocks(options?: {
hookRunner?: "minimal" | "full";
}): void {
@@ -50,6 +54,7 @@ export function installEmbeddedRunnerBaseE2eMocks(options?: {
}));
}
/** Installs mocks that route embedded attempts through a caller-provided fast run function. */
export function installEmbeddedRunnerFastRunE2eMocks(
options: EmbeddedRunnerFastRunMockOptions,
): void {
@@ -170,6 +175,7 @@ function resolveMockHarnessId(params: {
: "openclaw";
}
/** Installs deterministic backoff mocks for retry/timeout E2E tests. */
export function installEmbeddedRunnerBackoffE2eMocks(
options: EmbeddedRunnerBackoffMockOptions,
): void {
@@ -1,3 +1,7 @@
/**
* Gateway mock helper for subagent-spawn tests that only require accepted RPC responses.
*/
/** Installs a gateway mock that accepts `agent` and `sessions.*` calls. */
export function installAcceptedSubagentGatewayMock(mock: {
mockImplementation: (
impl: (opts: { method?: string; params?: unknown }) => Promise<unknown>,