























@@ -1,10 +1,12 @@
11import { EventEmitter } from "node:events";
22import { PassThrough, Writable } from "node:stream";
3+import { Command } from "commander";
34import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-entry";
45import type { RealtimeVoiceProviderPlugin } from "openclaw/plugin-sdk/realtime-voice";
56import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
67import { createTestPluginApi } from "../../test/helpers/plugins/plugin-api.ts";
78import plugin from "./index.js";
9+import { registerGoogleMeetCli } from "./src/cli.js";
810import { resolveGoogleMeetConfig, resolveGoogleMeetConfigWithEnv } from "./src/config.js";
911import {
1012buildGoogleMeetPreflightReport,
@@ -19,6 +21,7 @@ import {
1921import { startNodeRealtimeAudioBridge } from "./src/realtime-node.js";
2022import { startCommandRealtimeAudioBridge } from "./src/realtime.js";
2123import { normalizeMeetUrl } from "./src/runtime.js";
24+import type { GoogleMeetRuntime } from "./src/runtime.js";
2225import { buildMeetDtmfSequence, normalizeDialInNumber } from "./src/transports/twilio.js";
23262427const voiceCallMocks = vi.hoisted(() => ({
@@ -57,6 +60,18 @@ const noopLogger = {
5760debug: vi.fn(),
5861};
596263+function captureStdout() {
64+let output = "";
65+const writeSpy = vi.spyOn(process.stdout, "write").mockImplementation(((chunk: unknown) => {
66+output += String(chunk);
67+return true;
68+}) as typeof process.stdout.write);
69+return {
70+output: () => output,
71+restore: () => writeSpy.mockRestore(),
72+};
73+}
74+6075type TestBridgeProcess = {
6176stdin?: { write(chunk: unknown): unknown } | null;
6277stdout?: { on(event: "data", listener: (chunk: unknown) => void): unknown } | null;
@@ -627,6 +642,65 @@ describe("google-meet plugin", () => {
627642);
628643});
629644645+it("CLI setup prints human-readable checks by default", async () => {
646+const program = new Command();
647+const stdout = captureStdout();
648+registerGoogleMeetCli({
649+ program,
650+config: resolveGoogleMeetConfig({}),
651+ensureRuntime: async () =>
652+({
653+setupStatus: () => ({
654+ok: true,
655+checks: [
656+{
657+id: "audio-bridge",
658+ok: true,
659+message: "Chrome command-pair realtime audio bridge configured",
660+},
661+],
662+}),
663+}) as GoogleMeetRuntime,
664+});
665+666+try {
667+await program.parseAsync(["googlemeet", "setup"], { from: "user" });
668+expect(stdout.output()).toContain("Google Meet setup: OK");
669+expect(stdout.output()).toContain(
670+"[ok] audio-bridge: Chrome command-pair realtime audio bridge configured",
671+);
672+expect(stdout.output()).not.toContain('"checks"');
673+} finally {
674+stdout.restore();
675+}
676+});
677+678+it("CLI setup preserves JSON output with --json", async () => {
679+const program = new Command();
680+const stdout = captureStdout();
681+registerGoogleMeetCli({
682+ program,
683+config: resolveGoogleMeetConfig({}),
684+ensureRuntime: async () =>
685+({
686+setupStatus: () => ({
687+ok: false,
688+checks: [{ id: "twilio-voice-call-plugin", ok: false, message: "missing" }],
689+}),
690+}) as GoogleMeetRuntime,
691+});
692+693+try {
694+await program.parseAsync(["googlemeet", "setup", "--json"], { from: "user" });
695+expect(JSON.parse(stdout.output())).toMatchObject({
696+ok: false,
697+checks: [{ id: "twilio-voice-call-plugin", ok: false }],
698+});
699+} finally {
700+stdout.restore();
701+}
702+});
703+630704it("launches Chrome after the BlackHole check", async () => {
631705const originalPlatform = process.platform;
632706Object.defineProperty(process, "platform", { value: "darwin" });
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。