


























@@ -0,0 +1,44 @@
1+import { spawnSync } from "node:child_process";
2+import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
3+import { tmpdir } from "node:os";
4+import path from "node:path";
5+import { afterEach, describe, expect, it } from "vitest";
6+7+const tempDirs: string[] = [];
8+const scriptPath = "scripts/notarize-mac-artifact.sh";
9+10+function makeTempDir(prefix: string): string {
11+const dir = mkdtempSync(path.join(tmpdir(), prefix));
12+tempDirs.push(dir);
13+return dir;
14+}
15+16+afterEach(() => {
17+for (const dir of tempDirs.splice(0)) {
18+rmSync(dir, { recursive: true, force: true });
19+}
20+});
21+22+describe("notarize-mac-artifact input validation", () => {
23+it("fails before notarization when an explicit staple app path is missing", () => {
24+const tempRoot = makeTempDir("openclaw-notary-staple-");
25+const artifact = path.join(tempRoot, "OpenClaw.zip");
26+const missingApp = path.join(tempRoot, "Missing.app");
27+writeFileSync(artifact, "placeholder", "utf8");
28+29+const result = spawnSync("bash", [scriptPath, artifact], {
30+cwd: process.cwd(),
31+encoding: "utf8",
32+env: {
33+ ...process.env,
34+STAPLE_APP_PATH: missingApp,
35+},
36+});
37+38+expect(result.status).toBe(1);
39+expect(result.stderr).toContain("Error: STAPLE_APP_PATH not found");
40+expect(result.stderr).not.toContain("xcrun not found");
41+expect(result.stderr).not.toContain("Notary auth missing");
42+expect(result.stdout).not.toContain("Notarizing:");
43+});
44+});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。