Files
openclaw-openclaw/test/scripts/apple-app-i18n.test.ts
2026-07-01 05:19:12 -07:00

32 lines
1.2 KiB
TypeScript

import { mkdtemp, readFile, rm } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { checkAppleAppI18n, compileMacosLocalizations } from "../../scripts/apple-app-i18n.ts";
describe("Apple app i18n catalogs", () => {
it("keeps phased source coverage complete for every native locale", async () => {
await expect(checkAppleAppI18n()).resolves.toBeUndefined();
});
it("compiles macOS catalogs into app-bundle localization directories", async () => {
const outputDir = await mkdtemp(path.join(os.tmpdir(), "openclaw-apple-i18n-"));
try {
await compileMacosLocalizations(outputDir);
const swedish = await readFile(
path.join(outputDir, "sv.lproj", "Localizable.strings"),
"utf8",
);
expect(swedish).toContain('"Logout" = "Logga ut";');
await expect(
readFile(path.join(outputDir, "zh-Hans.lproj", "Localizable.strings"), "utf8"),
).resolves.toContain('"Save" = ');
await expect(
readFile(path.join(outputDir, "ja.lproj", "Localizable.strings"), "utf8"),
).resolves.toContain('"Run now" = ');
} finally {
await rm(outputDir, { force: true, recursive: true });
}
});
});