






























@@ -2,8 +2,8 @@
22import fs from "node:fs/promises";
33import path from "node:path";
44import { Readable } from "node:stream";
5-import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
6-import { createTempDirTracker } from "../../../test/helpers/temp-dir.js";
5+import { withTempDir } from "openclaw/plugin-sdk/test-env";
6+import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
77import type { ClawdbotConfig } from "../runtime-api.js";
8899const createFeishuClientMock = vi.hoisted(() => vi.fn());
@@ -21,7 +21,6 @@ const messageReplyMock = vi.hoisted(() => vi.fn());
21212222const FEISHU_MEDIA_HTTP_TIMEOUT_MS = 120_000;
2323const emptyConfig: ClawdbotConfig = {};
24-const tempDirs = createTempDirTracker();
25242625vi.mock("./client.js", () => ({
2726createFeishuClient: createFeishuClientMock,
@@ -101,24 +100,20 @@ function callData<T>(
101100102101async function withIsolatedHome<T>(run: () => Promise<T>): Promise<T> {
103102const originalHome = process.env.HOME;
104-const tempHome = tempDirs.make("openclaw-feishu-media-");
105-try {
106-process.env.HOME = tempHome;
107-return await run();
108-} finally {
109-if (originalHome === undefined) {
110-delete process.env.HOME;
111-} else {
112-process.env.HOME = originalHome;
103+return await withTempDir("openclaw-feishu-media-", async (tempHome) => {
104+try {
105+process.env.HOME = tempHome;
106+return await run();
107+} finally {
108+if (originalHome === undefined) {
109+delete process.env.HOME;
110+} else {
111+process.env.HOME = originalHome;
112+}
113113}
114-tempDirs.cleanup();
115-}
114+});
116115}
117116118-afterEach(() => {
119-tempDirs.cleanup();
120-});
121-122117describe("sendMediaFeishu msg_type routing", () => {
123118beforeAll(async () => {
124119({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。