Skip to content

Commit 853d50f

Browse files
committed
test: use tracked prompt template fixture
1 parent 8edbb1b commit 853d50f

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

src/agents/sessions/prompt-templates.test.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
// Prompt template tests cover markdown discovery and fallback metadata.
2-
import { mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
3-
import { tmpdir } from "node:os";
2+
import { mkdir, writeFile } from "node:fs/promises";
43
import { join } from "node:path";
54
import { afterEach, describe, expect, it } from "vitest";
5+
import { useAutoCleanupTempDirTracker } from "../../../test/helpers/temp-dir.js";
66
import { loadPromptTemplates } from "./prompt-templates.js";
77

8-
const tempDirs: string[] = [];
9-
10-
afterEach(async () => {
11-
await Promise.all(tempDirs.splice(0).map((dir) => rm(dir, { recursive: true, force: true })));
12-
});
8+
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
139

1410
describe("loadPromptTemplates", () => {
1511
it("keeps fallback descriptions on a UTF-16 boundary", async () => {
16-
const root = await mkdtemp(join(tmpdir(), "openclaw-prompt-templates-"));
17-
tempDirs.push(root);
12+
const root = tempDirs.make("openclaw-prompt-templates-");
1813
const promptsDir = join(root, "prompts");
1914
await mkdir(promptsDir, { recursive: true });
2015
await writeFile(join(promptsDir, "emoji.md"), `${"a".repeat(59)}🚀tail\n`, "utf-8");

0 commit comments

Comments
 (0)