




















@@ -2175,40 +2175,39 @@ describe("google-meet plugin", () => {
2175217521762176expect(respond.mock.calls[0]?.[0]).toBe(true);
21772177expect(runCommandWithTimeout).not.toHaveBeenCalled();
2178-expect(callGatewayFromCli).toHaveBeenCalledWith(
2179-"browser.request",
2180-expect.any(Object),
2181-expect.objectContaining({
2182-method: "POST",
2183-path: "/tabs/open",
2184-body: { url: "https://meet.google.com/abc-defg-hij" },
2185-}),
2186-{ progress: false },
2178+const openCall = callGatewayFromCli.mock.calls.find(
2179+([, , request]) => requireRecord(request, "browser request").path === "/tabs/open",
21872180);
2181+if (!openCall) {
2182+throw new Error("Expected browser /tabs/open request");
2183+}
2184+expect(openCall[0]).toBe("browser.request");
2185+expect(openCall[2]).toEqual({
2186+method: "POST",
2187+path: "/tabs/open",
2188+timeoutMs: 30000,
2189+body: { url: "https://meet.google.com/abc-defg-hij" },
2190+});
2191+expect(openCall[3]).toEqual({ progress: false });
21882192expect(
21892193callGatewayFromCli.mock.calls.some(
21902194([, , request]) => (request as { path?: string }).path === "/permissions/grant",
21912195),
21922196).toBe(false);
2193-expect(respond.mock.calls[0]?.[1]).toMatchObject({
2194-session: {
2195-chrome: {
2196-health: {
2197-captioning: true,
2198-captionsEnabledAttempted: true,
2199-transcriptLines: 1,
2200-lastCaptionSpeaker: "Alice",
2201-lastCaptionText: "Can everyone hear the agent?",
2202-recentTranscript: [
2203-{
2204-speaker: "Alice",
2205-text: "Can everyone hear the agent?",
2206-},
2207-],
2208-},
2209-},
2210-},
2211-});
2197+const payload = requireRecord(respond.mock.calls[0]?.[1], "join response payload");
2198+const session = requireRecord(payload.session, "join session");
2199+const chrome = requireRecord(session.chrome, "join chrome session");
2200+const health = requireRecord(chrome.health, "join chrome health");
2201+expect(health.captioning).toBe(true);
2202+expect(health.captionsEnabledAttempted).toBe(true);
2203+expect(health.transcriptLines).toBe(1);
2204+expect(health.lastCaptionSpeaker).toBe("Alice");
2205+expect(health.lastCaptionText).toBe("Can everyone hear the agent?");
2206+const recentTranscript = health.recentTranscript as unknown[];
2207+expect(recentTranscript).toHaveLength(1);
2208+const transcriptLine = requireRecord(recentTranscript[0], "recent transcript line");
2209+expect(transcriptLine.speaker).toBe("Alice");
2210+expect(transcriptLine.text).toBe("Can everyone hear the agent?");
22122211const actCall = callGatewayFromCli.mock.calls.find(
22132212([, , request]) => (request as { path?: string }).path === "/act",
22142213);
@@ -2255,20 +2254,21 @@ describe("google-meet plugin", () => {
22552254});
2256225522572256expect(respond.mock.calls[0]?.[0]).toBe(true);
2258-expect(callGatewayFromCli).toHaveBeenCalledWith(
2259-"browser.request",
2260-expect.any(Object),
2261-expect.objectContaining({
2262-method: "POST",
2263-path: "/permissions/grant",
2264-body: expect.objectContaining({
2265-origin: "https://meet.google.com",
2266-permissions: ["audioCapture", "videoCapture"],
2267-targetId: "local-meet-tab",
2268-}),
2269-}),
2270-{ progress: false },
2257+const grantCall = callGatewayFromCli.mock.calls.find(
2258+([, , request]) => requireRecord(request, "browser request").path === "/permissions/grant",
22712259);
2260+if (!grantCall) {
2261+throw new Error("Expected browser /permissions/grant request");
2262+}
2263+expect(grantCall[0]).toBe("browser.request");
2264+const request = requireRecord(grantCall[2], "permissions request");
2265+expect(request.method).toBe("POST");
2266+expect(request.path).toBe("/permissions/grant");
2267+const body = requireRecord(request.body, "permissions request body");
2268+expect(body.origin).toBe("https://meet.google.com");
2269+expect(body.permissions).toEqual(["audioCapture", "videoCapture"]);
2270+expect(body.targetId).toBe("local-meet-tab");
2271+expect(grantCall[3]).toEqual({ progress: false });
22722272} finally {
22732273Object.defineProperty(process, "platform", { value: originalPlatform });
22742274}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。