mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-23 13:28:12 +00:00
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { spawnSync } from "node:child_process";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const SCRIPT = "scripts/android-screenshots.sh";
|
|
|
|
function runAndroidScreenshots(args: string[]) {
|
|
return spawnSync("bash", [SCRIPT, ...args], {
|
|
encoding: "utf8",
|
|
});
|
|
}
|
|
|
|
describe("android screenshots script", () => {
|
|
it("dry-runs with a normalized locale output path", () => {
|
|
const result = runAndroidScreenshots(["--dry-run", "--locale", "pt-BR"]);
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toContain(
|
|
"apps/android/fastlane/metadata/android/pt-BR/images/phoneScreenshots",
|
|
);
|
|
expect(result.stdout).toContain("Dry run complete.");
|
|
});
|
|
|
|
it.each(["../escape", "en/US", ".hidden", "en..US", ""])(
|
|
"rejects locale path escapes before dry-run output: %j",
|
|
(locale) => {
|
|
const result = runAndroidScreenshots(["--dry-run", "--locale", locale]);
|
|
|
|
expect(result.status).not.toBe(0);
|
|
expect(result.stderr).toContain("Invalid Android screenshot locale");
|
|
expect(result.stderr).toContain("path separators and dot segments are not allowed");
|
|
expect(result.stdout).not.toContain("Android screenshot output:");
|
|
},
|
|
);
|
|
});
|