






















@@ -94,6 +94,19 @@ function setup(
9494return harness;
9595}
969697+async function withProcessPlatform<T>(
98+platform: NodeJS.Platform,
99+callback: () => Promise<T>,
100+): Promise<T> {
101+const originalPlatform = process.platform;
102+Object.defineProperty(process, "platform", { value: platform });
103+try {
104+return await callback();
105+} finally {
106+Object.defineProperty(process, "platform", { value: originalPlatform });
107+}
108+}
109+97110function jsonResponse(value: unknown): Response {
98111return new Response(JSON.stringify(value), {
99112status: 200,
@@ -1893,9 +1906,11 @@ describe("google-meet plugin", () => {
18931906| undefined;
18941907const respond = vi.fn();
189519081896-await handler?.({
1897-params: { url: "https://meet.google.com/abc-defg-hij" },
1898- respond,
1909+await withProcessPlatform("darwin", async () => {
1910+await handler?.({
1911+params: { url: "https://meet.google.com/abc-defg-hij" },
1912+ respond,
1913+});
18991914});
1900191519011916expect(respond.mock.calls[0]?.[0]).toBe(true);
@@ -1982,9 +1997,11 @@ describe("google-meet plugin", () => {
19821997| undefined;
19831998const respond = vi.fn();
198419991985-await handler?.({
1986-params: { url: "https://meet.google.com/abc-defg-hij" },
1987- respond,
2000+await withProcessPlatform("darwin", async () => {
2001+await handler?.({
2002+params: { url: "https://meet.google.com/abc-defg-hij" },
2003+ respond,
2004+});
19882005});
1989200619902007expect(respond.mock.calls[0]?.[0]).toBe(true);
@@ -2060,9 +2077,11 @@ describe("google-meet plugin", () => {
20602077| undefined;
20612078const respond = vi.fn();
206220792063-await handler?.({
2064-params: { url: "https://meet.google.com/abc-defg-hij" },
2065- respond,
2080+await withProcessPlatform("darwin", async () => {
2081+await handler?.({
2082+params: { url: "https://meet.google.com/abc-defg-hij" },
2083+ respond,
2084+});
20662085});
2067208620682087expect(respond.mock.calls[0]?.[0]).toBe(true);
@@ -2310,14 +2329,19 @@ describe("google-meet plugin", () => {
23102329).runInContext(context) as () => string | Promise<string>;
2311233023122331const first = JSON.parse(await inspect()) as { captionsEnabledAttempted?: boolean };
2313-const stateAfterFirst = windowState.__openclawMeetCaptions as { enabledAttempted?: boolean };
2332+const captionsStateKey = "__openclawMeetCaptions";
2333+const stateAfterFirst = windowState[captionsStateKey] as {
2334+enabledAttempted?: boolean;
2335+};
23142336expect(first.captionsEnabledAttempted).toBe(false);
23152337expect(stateAfterFirst.enabledAttempted).toBe(false);
23162338expect(captionButton.click).not.toHaveBeenCalled();
2317233923182340page.buttons = [leaveButton, captionButton];
23192341const second = JSON.parse(await inspect()) as { captionsEnabledAttempted?: boolean };
2320-const stateAfterSecond = windowState.__openclawMeetCaptions as { enabledAttempted?: boolean };
2342+const stateAfterSecond = windowState[captionsStateKey] as {
2343+enabledAttempted?: boolean;
2344+};
23212345expect(second.captionsEnabledAttempted).toBe(true);
23222346expect(stateAfterSecond.enabledAttempted).toBe(true);
23232347expect(captionButton.click).toHaveBeenCalledTimes(1);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。