docs: document gateway test helper fixtures

This commit is contained in:
Peter Steinberger
2026-06-04 17:47:12 -04:00
parent 15afc1d34c
commit 8779bc49e0
4 changed files with 8 additions and 11 deletions

View File

@@ -1,11 +1,10 @@
// Minimal Gateway websocket test helpers.
// Provides small fake-server frames for client/backend tests.
import type WebSocket from "ws";
import type { WebSocketServer } from "ws";
import { PROTOCOL_VERSION } from "../../packages/gateway-protocol/src/index.js";
import { rawDataToString } from "../infra/ws.js";
/**
* Minimal WebSocket gateway fixtures used by client/backend tests.
*/
export type MinimalGatewayRequestFrame = {
type?: string;
id?: string;

View File

@@ -1,3 +1,5 @@
// Gateway config runtime test mock.
// Wraps config IO with mutable test runtime state for integration tests.
import fsSync from "node:fs";
import fs from "node:fs/promises";
import os from "node:os";
@@ -13,9 +15,6 @@ import type { ConfigFileSnapshot, OpenClawConfig } from "../config/types.js";
import { buildTestConfigSnapshot } from "./test-helpers.config-snapshots.js";
import { testConfigRoot, testIsNixMode, testState } from "./test-helpers.runtime-state.js";
/**
* Config module mock factory used by gateway integration tests.
*/
type GatewayConfigModule = typeof import("../config/config.js");
/** Wraps the real config module with gateway-test runtime overrides. */

View File

@@ -1,8 +1,8 @@
// Gateway maintenance-state test helper.
// Builds minimal timer/health/chat state for maintenance tests.
import type { HealthSummary } from "../commands/health.js";
import { createChatRunState } from "./server-chat-state.js";
// Minimal Gateway maintenance state fixture for tests.
/** Create a Gateway maintenance-state stub with configurable health/presence versions. */
export function createGatewayMaintenanceStateForTest(params?: {
healthSummary?: HealthSummary;

View File

@@ -1,3 +1,5 @@
// Gateway integration test module mocks.
// Centralizes Vitest mock wiring for agent, channel, plugin, and runtime seams.
import path from "node:path";
import { vi } from "vitest";
import {
@@ -26,9 +28,6 @@ import {
type RunBtwSideQuestionFn,
} from "./test-helpers.runtime-state.js";
/**
* Central Vitest module mock setup for gateway integration tests.
*/
export { getTestPluginRegistry, resetTestPluginRegistry, setTestPluginRegistry };
export {
agentCommand,