Skip to content

Commit 9e1cf3b

Browse files
committed
test(i18n): use shared temp directory helper
1 parent 3ef7772 commit 9e1cf3b

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

test/scripts/native-app-i18n.test.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { mkdtemp, readFile, rm, stat } from "node:fs/promises";
2-
import os from "node:os";
1+
import { readFile, stat } from "node:fs/promises";
32
import path from "node:path";
43
import { describe, expect, it } from "vitest";
54
import {
@@ -9,6 +8,7 @@ import {
98
syncNativeLocale,
109
type NativeI18nEntry,
1110
} from "../../scripts/native-app-i18n.ts";
11+
import { cleanupTempDirs, makeTempDir } from "../helpers/temp-dir.js";
1212

1313
describe("native app i18n inventory", () => {
1414
it("collects stable Android and Apple UI entries", async () => {
@@ -123,7 +123,8 @@ describe("native app i18n inventory", () => {
123123
});
124124

125125
it("creates a first-run locale artifact and leaves a complete artifact unchanged", async () => {
126-
const translationsDir = await mkdtemp(path.join(os.tmpdir(), "openclaw-native-i18n-"));
126+
const tempDirs: string[] = [];
127+
const translationsDir = makeTempDir(tempDirs, "openclaw-native-i18n-");
127128
const entries: NativeI18nEntry[] = [
128129
{
129130
id: "native.android.hello",
@@ -193,12 +194,13 @@ describe("native app i18n inventory", () => {
193194
expect(await readFile(artifactPath, "utf8")).toBe(firstContents);
194195
expect((await stat(artifactPath)).mtimeMs).toBe(firstModifiedAt);
195196
} finally {
196-
await rm(translationsDir, { force: true, recursive: true });
197+
cleanupTempDirs(tempDirs);
197198
}
198199
});
199200

200201
it("rejects native printf placeholder drift", async () => {
201-
const translationsDir = await mkdtemp(path.join(os.tmpdir(), "openclaw-native-i18n-"));
202+
const tempDirs: string[] = [];
203+
const translationsDir = makeTempDir(tempDirs, "openclaw-native-i18n-");
202204
const cases = [
203205
{
204206
entry: {
@@ -237,7 +239,7 @@ describe("native app i18n inventory", () => {
237239
);
238240
}
239241
} finally {
240-
await rm(translationsDir, { force: true, recursive: true });
242+
cleanupTempDirs(tempDirs);
241243
}
242244
});
243245

0 commit comments

Comments
 (0)