Skip to content

Commit c807de8

Browse files
committed
test(voice-call): track fixture temp directories
1 parent e1338bb commit c807de8

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

extensions/voice-call/src/voice-call-cli-rpc-agent-tool.e2e.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Voice Call E2E tests cover CLI, Gateway RPC, and agent tool through the mock provider.
22
import fs from "node:fs";
33
import { createServer } from "node:net";
4-
import os from "node:os";
54
import path from "node:path";
65
import { Command } from "commander";
76
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-entry";
@@ -12,6 +11,7 @@ import plugin from "../index.js";
1211
import { testing as voiceCallCliTesting } from "./cli.js";
1312
import {
1413
createVoiceCallStateRuntimeForTests,
14+
createTestStorePath,
1515
installVoiceCallStateRuntimeForTests,
1616
} from "./manager.test-harness.js";
1717
import { clearVoiceCallStateRuntime } from "./runtime-state.js";
@@ -48,8 +48,11 @@ function isAddressInUseError(error: unknown): boolean {
4848
return error instanceof Error && `${error.message}\n${error.stack ?? ""}`.includes("EADDRINUSE");
4949
}
5050

51+
const tempDirs = new Set<string>();
52+
5153
async function runVoiceCallEntryPointFixture(): Promise<void> {
52-
const stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-voice-call-qa-"));
54+
const stateDir = createTestStorePath();
55+
tempDirs.add(stateDir);
5356
vi.stubEnv("OPENCLAW_STATE_DIR", stateDir);
5457
resetPluginStateStoreForTests();
5558
installVoiceCallStateRuntimeForTests();
@@ -167,7 +170,6 @@ async function runVoiceCallEntryPointFixture(): Promise<void> {
167170
resetPluginStateStoreForTests();
168171
vi.unstubAllEnvs();
169172
vi.restoreAllMocks();
170-
fs.rmSync(stateDir, { force: true, recursive: true });
171173
}
172174
}
173175

@@ -178,6 +180,10 @@ describe("QA Voice Call CLI, RPC, and agent tool", () => {
178180
resetPluginStateStoreForTests();
179181
vi.unstubAllEnvs();
180182
vi.restoreAllMocks();
183+
for (const dir of tempDirs) {
184+
fs.rmSync(dir, { force: true, recursive: true });
185+
}
186+
tempDirs.clear();
181187
});
182188

183189
it("routes all three entry points through one mock-provider runtime", async () => {

0 commit comments

Comments
 (0)