
























@@ -1,10 +1,7 @@
1-import { EventEmitter } from "node:events";
21import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/setup";
32import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
43import { createMSTeamsSetupWizardBase, msteamsSetupAdapter } from "./setup-core.js";
5-import { openDelegatedOAuthUrl } from "./setup-surface.js";
647-const spawn = vi.hoisted(() => vi.fn());
85const resolveMSTeamsUserAllowlist = vi.hoisted(() => vi.fn());
96const resolveMSTeamsChannelAllowlist = vi.hoisted(() => vi.fn());
107const normalizeSecretInputString = vi.hoisted(() =>
@@ -28,19 +25,10 @@ vi.mock("./token.js", () => ({
2825 resolveMSTeamsCredentials,
2926}));
302731-vi.mock("node:child_process", async (importOriginal) => {
32-const actual = await importOriginal<typeof import("node:child_process")>();
33-return {
34- ...actual,
35- spawn,
36-};
37-});
38-3928describe("msteams setup surface", () => {
4029const msteamsSetupWizard = createMSTeamsSetupWizardBase();
41304231beforeEach(() => {
43-spawn.mockReset();
4432resolveMSTeamsUserAllowlist.mockReset();
4533resolveMSTeamsChannelAllowlist.mockReset();
4634normalizeSecretInputString.mockClear();
@@ -58,21 +46,6 @@ describe("msteams setup surface", () => {
5846);
5947});
604861-it("opens delegated OAuth URLs without invoking a shell", async () => {
62-const url = "https://login.microsoftonline.com/auth?state=$(touch pwned)";
63-const child = new EventEmitter();
64-spawn.mockReturnValue(child);
65-66-const result = openDelegatedOAuthUrl(url);
67-child.emit("exit", 0, null);
68-69-await expect(result).resolves.toBeUndefined();
70-expect(spawn).toHaveBeenCalledWith(process.platform === "darwin" ? "open" : "xdg-open", [url], {
71-stdio: "ignore",
72-shell: false,
73-});
74-});
75-7649it("enables the msteams channel without dropping existing config", () => {
7750expect(
7851msteamsSetupAdapter.applyAccountConfig?.({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。