




















@@ -1,4 +1,9 @@
11import { createTestPluginApi } from "openclaw/plugin-sdk/plugin-test-api";
2+import {
3+createSetupWizardAdapter,
4+createQueuedWizardPrompter,
5+runSetupWizardConfigure,
6+} from "openclaw/plugin-sdk/plugin-test-runtime";
27import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/setup";
38import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
49import type { OpenClawConfig, OpenClawPluginApi } from "../runtime-api.js";
@@ -352,6 +357,41 @@ describe("mattermost setup", () => {
352357},
353358});
354359});
360+361+it("prompts for bot token and server URL before validating wizard setup", async () => {
362+normalizeMattermostBaseUrl.mockImplementation((value: string | undefined) =>
363+value?.startsWith("http") ? value : undefined,
364+);
365+const queued = createQueuedWizardPrompter({
366+textValues: ["bot-token", "https://chat.example.com"],
367+});
368+const adapter = createSetupWizardAdapter({
369+plugin: {
370+id: "mattermost",
371+meta: { label: "Mattermost" },
372+config: {
373+listAccountIds: () => [DEFAULT_ACCOUNT_ID],
374+},
375+setup: mattermostSetupAdapter,
376+} as never,
377+wizard: mattermostSetupWizard,
378+});
379+380+const result = await runSetupWizardConfigure({
381+configure: adapter.configure,
382+cfg: { channels: { mattermost: {} } } as OpenClawConfig,
383+prompter: queued.prompter,
384+options: { secretInputMode: "plaintext" as const },
385+});
386+387+const textMessages = queued.text.mock.calls.map(
388+([params]) => (params as { message: string }).message,
389+);
390+expect(textMessages).toEqual(["Enter Mattermost bot token", "Enter Mattermost base URL"]);
391+expect(result.cfg.channels?.mattermost?.botToken).toBe("bot-token");
392+expect(result.cfg.channels?.mattermost?.baseUrl).toBe("https://chat.example.com");
393+expect(result.accountId).toBe(DEFAULT_ACCOUNT_ID);
394+});
355395});
356396357397function registerEnvDefaults() {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。