mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
test: use managed skill workshop state
This commit is contained in:
@@ -3,23 +3,28 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import { captureEnv } from "../../test-utils/env.js";
|
||||
import {
|
||||
createOpenClawTestState,
|
||||
type OpenClawTestState,
|
||||
} from "../../test-utils/openclaw-test-state.js";
|
||||
import { createTrackedTempDirs } from "../../test-utils/tracked-temp-dirs.js";
|
||||
import { createOpenClawTools } from "../openclaw-tools.js";
|
||||
import { createSkillWorkshopTool } from "./skill-workshop-tool.js";
|
||||
|
||||
const tempDirs = createTrackedTempDirs();
|
||||
let envSnapshot: ReturnType<typeof captureEnv>;
|
||||
let testState: OpenClawTestState;
|
||||
let stateDir = "";
|
||||
|
||||
beforeEach(async () => {
|
||||
envSnapshot = captureEnv(["OPENCLAW_STATE_DIR"]);
|
||||
stateDir = await tempDirs.make("openclaw-skill-workshop-state-");
|
||||
process.env.OPENCLAW_STATE_DIR = stateDir;
|
||||
testState = await createOpenClawTestState({
|
||||
layout: "state-only",
|
||||
prefix: "openclaw-skill-workshop-state-",
|
||||
});
|
||||
stateDir = testState.stateDir;
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
envSnapshot.restore();
|
||||
await testState.cleanup();
|
||||
await tempDirs.cleanup();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user