test: snapshot task flow audit env

This commit is contained in:
Shakker
2026-06-05 00:57:44 +01:00
parent 0f9bb59b73
commit 064182aff8

View File

@@ -1,5 +1,6 @@
// Covers managed task-flow audit summaries and stale-flow classification.
import { afterEach, describe, expect, it } from "vitest";
import { captureEnv } from "../test-utils/env.js";
import { withOpenClawTestState } from "../test-utils/openclaw-test-state.js";
import { createRunningTaskRun as createRunningTaskRunOrNull } from "./task-executor.js";
import {
@@ -20,7 +21,7 @@ import {
} from "./task-registry.js";
import type { TaskRecord } from "./task-registry.types.js";
const ORIGINAL_STATE_DIR = process.env.OPENCLAW_STATE_DIR;
const ORIGINAL_ENV = captureEnv(["OPENCLAW_STATE_DIR"]);
function createManagedTaskFlow(
params: Parameters<typeof createManagedTaskFlowOrNull>[0],
@@ -80,11 +81,7 @@ async function withTaskFlowAuditStateDir(run: (root: string) => Promise<void>):
describe("task-flow-registry audit", () => {
afterEach(() => {
if (ORIGINAL_STATE_DIR === undefined) {
delete process.env.OPENCLAW_STATE_DIR;
} else {
process.env.OPENCLAW_STATE_DIR = ORIGINAL_STATE_DIR;
}
ORIGINAL_ENV.restore();
resetTaskRegistryDeliveryRuntimeForTests();
resetTaskRegistryForTests();
resetTaskFlowRegistryForTests();