mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-05 13:52:27 +00:00
* chore(lint): clean Android-Linux app assets batch * chore(lint): clean setup-launcher-plugin batch * chore(lint): clean changelog-updater batch * chore(lint): clean QA-runtime-helper batch * chore(lint): clean script-tests batch * fix(mxc): await sandbox spawn before bridge selection * fix(test): make fake plutil metacharacter escaping survive the template hop
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
const { execFileSyncMock } = vi.hoisted(() => ({
|
|
execFileSyncMock: vi.fn(),
|
|
}));
|
|
|
|
vi.mock("node:child_process", async () => {
|
|
const actual = await vi.importActual<typeof import("node:child_process")>("node:child_process");
|
|
return {
|
|
...actual,
|
|
execFileSync: execFileSyncMock,
|
|
};
|
|
});
|
|
|
|
describe("sync-labels", () => {
|
|
beforeEach(() => {
|
|
vi.resetModules();
|
|
execFileSyncMock.mockReset();
|
|
execFileSyncMock.mockImplementation((command: string, args?: readonly string[]) => {
|
|
if (command === "git") {
|
|
return "https://github.com/openclaw/openclaw.git\n";
|
|
}
|
|
if (command === "gh" && args?.some((arg) => arg.includes("/labels?"))) {
|
|
return "[]";
|
|
}
|
|
return "";
|
|
});
|
|
vi.spyOn(console, "log").mockImplementation(() => undefined);
|
|
});
|
|
|
|
afterEach(() => {
|
|
vi.restoreAllMocks();
|
|
});
|
|
|
|
it("bounds every GitHub CLI operation", async () => {
|
|
await import("../../scripts/sync-labels.ts");
|
|
|
|
const ghCalls = execFileSyncMock.mock.calls.filter(([command]) => command === "gh");
|
|
expect(ghCalls.length).toBeGreaterThan(1);
|
|
for (const call of ghCalls) {
|
|
const options = call[2];
|
|
expect(options).toMatchObject({
|
|
timeout: 120_000,
|
|
killSignal: "SIGKILL",
|
|
});
|
|
}
|
|
});
|
|
});
|