
























@@ -3145,19 +3145,28 @@ describe("google-meet plugin", () => {
31453145 respond,
31463146});
314731473148-expect(nodesInvoke).toHaveBeenCalledWith(
3149-expect.objectContaining({
3150-params: expect.objectContaining({
3151-path: "/tabs/focus",
3152-body: { targetId: "existing-meet-tab" },
3153-}),
3154-}),
3155-);
3156-expect(nodesInvoke).not.toHaveBeenCalledWith(
3157-expect.objectContaining({
3158-params: expect.objectContaining({ path: "/tabs/open" }),
3148+const focusCall = nodesInvoke.mock.calls.find(([rawCall]) => {
3149+const call = requireRecord(rawCall, "node invoke");
3150+const params = requireRecord(call.params, "node invoke params");
3151+return params.path === "/tabs/focus";
3152+});
3153+if (!focusCall) {
3154+throw new Error("Expected browser.proxy /tabs/focus node invoke");
3155+}
3156+expect(
3157+requireRecord(requireRecord(focusCall[0], "focus node invoke").params, "focus params"),
3158+).toEqual({
3159+method: "POST",
3160+path: "/tabs/focus",
3161+timeoutMs: 5000,
3162+body: { targetId: "existing-meet-tab" },
3163+});
3164+expect(
3165+nodesInvoke.mock.calls.some(([rawCall]) => {
3166+const call = requireRecord(rawCall, "node invoke");
3167+return requireRecord(call.params, "node invoke params").path === "/tabs/open";
31593168}),
3160-);
3169+).toBe(false);
31613170});
3162317131633172it("recovers and inspects an existing Meet tab without opening a new one", async () => {
@@ -3213,35 +3222,41 @@ describe("google-meet plugin", () => {
32133222execute: (
32143223id: string,
32153224params: unknown,
3216-) => Promise<{ details: { found?: boolean; browser?: unknown } }>;
3225+) => Promise<{ details: { found?: boolean; targetId?: string; browser?: unknown } }>;
32173226};
3218322732193228const result = await tool.execute("id", {
32203229action: "recover_current_tab",
32213230url: "https://meet.google.com/abc-defg-hij",
32223231});
322332323224-expect(result.details).toMatchObject({
3225-found: true,
3226-targetId: "existing-meet-tab",
3227-browser: {
3228-manualActionRequired: true,
3229-manualActionReason: "meet-admission-required",
3230-},
3233+expect(result.details.found).toBe(true);
3234+expect(result.details.targetId).toBe("existing-meet-tab");
3235+const browser = requireRecord(result.details.browser, "recovered browser state");
3236+expect(browser.manualActionRequired).toBe(true);
3237+expect(browser.manualActionReason).toBe("meet-admission-required");
3238+const focusCall = nodesInvoke.mock.calls.find(([rawCall]) => {
3239+const call = requireRecord(rawCall, "node invoke");
3240+const params = requireRecord(call.params, "node invoke params");
3241+return params.path === "/tabs/focus";
32313242});
3232-expect(nodesInvoke).toHaveBeenCalledWith(
3233-expect.objectContaining({
3234-params: expect.objectContaining({
3235-path: "/tabs/focus",
3236-body: { targetId: "existing-meet-tab" },
3237-}),
3238-}),
3239-);
3240-expect(nodesInvoke).not.toHaveBeenCalledWith(
3241-expect.objectContaining({
3242-params: expect.objectContaining({ path: "/tabs/open" }),
3243+if (!focusCall) {
3244+throw new Error("Expected browser.proxy /tabs/focus node invoke");
3245+}
3246+expect(
3247+requireRecord(requireRecord(focusCall[0], "focus node invoke").params, "focus params"),
3248+).toEqual({
3249+method: "POST",
3250+path: "/tabs/focus",
3251+timeoutMs: 5000,
3252+body: { targetId: "existing-meet-tab" },
3253+});
3254+expect(
3255+nodesInvoke.mock.calls.some(([rawCall]) => {
3256+const call = requireRecord(rawCall, "node invoke");
3257+return requireRecord(call.params, "node invoke params").path === "/tabs/open";
32433258}),
3244-);
3259+).toBe(false);
32453260});
3246326132473262it("recovers and inspects an existing local Chrome Meet tab", async () => {
@@ -3288,29 +3303,32 @@ describe("google-meet plugin", () => {
32883303execute: (
32893304id: string,
32903305params: unknown,
3291-) => Promise<{ details: { transport?: string; found?: boolean; browser?: unknown } }>;
3306+) => Promise<{
3307+details: { transport?: string; found?: boolean; targetId?: string; browser?: unknown };
3308+}>;
32923309};
3293331032943311const result = await tool.execute("id", {
32953312action: "recover_current_tab",
32963313url: "https://meet.google.com/abc-defg-hij",
32973314});
329833153299-expect(result.details).toMatchObject({
3300-transport: "chrome",
3301-found: true,
3302-targetId: "local-meet-tab",
3303-browser: {
3304-manualActionRequired: true,
3305-manualActionReason: "meet-admission-required",
3306-},
3307-});
3308-expect(callGatewayFromCli).toHaveBeenCalledWith(
3309-"browser.request",
3310-expect.any(Object),
3311-expect.objectContaining({ method: "POST", path: "/tabs/focus" }),
3312-{ progress: false },
3316+expect(result.details.transport).toBe("chrome");
3317+expect(result.details.found).toBe(true);
3318+expect(result.details.targetId).toBe("local-meet-tab");
3319+const browser = requireRecord(result.details.browser, "recovered browser state");
3320+expect(browser.manualActionRequired).toBe(true);
3321+expect(browser.manualActionReason).toBe("meet-admission-required");
3322+const focusCall = callGatewayFromCli.mock.calls.find(
3323+([, , request]) => requireRecord(request, "browser request").path === "/tabs/focus",
33133324);
3325+if (!focusCall) {
3326+throw new Error("Expected browser /tabs/focus request");
3327+}
3328+expect(focusCall[0]).toBe("browser.request");
3329+expect(requireRecord(focusCall[2], "focus request").method).toBe("POST");
3330+expect(requireRecord(focusCall[2], "focus request").path).toBe("/tabs/focus");
3331+expect(focusCall[3]).toEqual({ progress: false });
33143332expect(nodesInvoke).not.toHaveBeenCalled();
33153333});
33163334@@ -3338,13 +3356,15 @@ describe("google-meet plugin", () => {
33383356message: "Say exactly: hello.",
33393357});
334033583341-expect(nodesInvoke).toHaveBeenCalledWith(
3342-expect.objectContaining({
3343-command: "googlemeet.chrome",
3344-params: expect.objectContaining({ action: "start" }),
3345-}),
3346-);
3347-expect(result.details).toMatchObject({ createdSession: true });
3359+const startCall = nodesInvoke.mock.calls.find(([rawCall]) => {
3360+const call = requireRecord(rawCall, "node invoke");
3361+const params = requireRecord(call.params, "node invoke params");
3362+return call.command === "googlemeet.chrome" && params.action === "start";
3363+});
3364+if (!startCall) {
3365+throw new Error("Expected googlemeet.chrome start node invoke");
3366+}
3367+expect(result.details.createdSession).toBe(true);
33483368});
3349336933503370it("refreshes realtime browser state in status after a delayed Meet join", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。