From 18e33d44d4aee252f85c73a2a7cb05e8816d9086 Mon Sep 17 00:00:00 2001 From: Vincent Koc <25068+vincentkoc@users.noreply.github.com> Date: Wed, 1 Jul 2026 05:23:55 -0700 Subject: [PATCH] test(i18n): use shared temp directory helper --- test/scripts/native-app-i18n.test.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/scripts/native-app-i18n.test.ts b/test/scripts/native-app-i18n.test.ts index 00e218e5930..94cec4d6233 100644 --- a/test/scripts/native-app-i18n.test.ts +++ b/test/scripts/native-app-i18n.test.ts @@ -1,5 +1,4 @@ -import { mkdtemp, readFile, rm, stat } from "node:fs/promises"; -import os from "node:os"; +import { readFile, stat } from "node:fs/promises"; import path from "node:path"; import { describe, expect, it } from "vitest"; import { @@ -9,6 +8,7 @@ import { syncNativeLocale, type NativeI18nEntry, } from "../../scripts/native-app-i18n.ts"; +import { cleanupTempDirs, makeTempDir } from "../helpers/temp-dir.js"; describe("native app i18n inventory", () => { it("collects stable Android and Apple UI entries", async () => { @@ -123,7 +123,8 @@ describe("native app i18n inventory", () => { }); it("creates a first-run locale artifact and leaves a complete artifact unchanged", async () => { - const translationsDir = await mkdtemp(path.join(os.tmpdir(), "openclaw-native-i18n-")); + const tempDirs: string[] = []; + const translationsDir = makeTempDir(tempDirs, "openclaw-native-i18n-"); const entries: NativeI18nEntry[] = [ { id: "native.android.hello", @@ -193,12 +194,13 @@ describe("native app i18n inventory", () => { expect(await readFile(artifactPath, "utf8")).toBe(firstContents); expect((await stat(artifactPath)).mtimeMs).toBe(firstModifiedAt); } finally { - await rm(translationsDir, { force: true, recursive: true }); + cleanupTempDirs(tempDirs); } }); it("rejects native printf placeholder drift", async () => { - const translationsDir = await mkdtemp(path.join(os.tmpdir(), "openclaw-native-i18n-")); + const tempDirs: string[] = []; + const translationsDir = makeTempDir(tempDirs, "openclaw-native-i18n-"); const cases = [ { entry: { @@ -237,7 +239,7 @@ describe("native app i18n inventory", () => { ); } } finally { - await rm(translationsDir, { force: true, recursive: true }); + cleanupTempDirs(tempDirs); } });