mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
test: snapshot task flow maintenance env
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// Covers maintenance reconciliation for managed task-flow records.
|
||||
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 {
|
||||
@@ -22,7 +23,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 createFlowRecord(params: Parameters<typeof createFlowRecordOrNull>[0]): TaskFlowRecord {
|
||||
const flow = createFlowRecordOrNull(params);
|
||||
@@ -77,11 +78,7 @@ async function withTaskFlowMaintenanceStateDir(
|
||||
|
||||
describe("task-flow-registry maintenance", () => {
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user