let plugin: typeofimport("../index.js").default;
let mattermostSetupWizard: typeofimport("./setup-surface.js").mattermostSetupWizard;
let isMattermostConfigured: typeofimport("./setup-core.js").isMattermostConfigured;
let resolveMattermostAccountWithSecrets: typeofimport("./setup-core.js").resolveMattermostAccountWithSecrets;
let mattermostSetupAdapter: typeofimport("./setup-core.js").mattermostSetupAdapter;
it("reports configuration only when token and base url are both present", () => {
expect(
isMattermostConfigured({
botToken: "bot-token",
baseUrl: "https://chat.example.com",
config: {},
} as never),
).toBe(true);
expect(
validateInput!({
accountId: "secondary",
input: { useEnv: true },
} as never),
).toBe("Mattermost env vars can only be used for the default account.");
it("treats secret-ref tokens plus base url as configured", async () => { const configured = await mattermostSetupWizard.status.resolveConfigured({
cfg: {
channels: {
mattermost: {
baseUrl: "https://chat.example.com",
botToken: {
source: "env",
provider: "default",
id: "MATTERMOST_BOT_TOKEN",
},
},
},
} as OpenClawConfig,
});
expect(configured).toBe(true);
});
it("does not inherit configured state from a sibling when defaultAccount is named", async () => { const configured = await mattermostSetupWizard.status.resolveConfigured({
cfg: {
channels: {
mattermost: {
defaultAccount: "work",
accounts: {
alerts: {
baseUrl: "https://chat.example.com",
botToken: {
source: "env",
provider: "default",
id: "MATTERMOST_BOT_TOKEN",
},
},
work: {},
},
},
},
} as OpenClawConfig,
accountId: undefined,
});
expect(configured).toBe(false);
});
it("shows intro note only when the target account is not configured", () => {
expect(
mattermostSetupWizard.introNote?.shouldShow?.({
cfg: {
channels: {
mattermost: {},
},
} as OpenClawConfig,
accountId: "default",
} as never),
).toBe(true);
it("offers env shortcut only for the default account when env is present and config is empty", () => {
vi.stubEnv("MATTERMOST_BOT_TOKEN", "bot-token");
vi.stubEnv("MATTERMOST_URL", "https://chat.example.com");
expect(
mattermostSetupWizard.envShortcut?.isAvailable?.({
cfg: { channels: { mattermost: {} } } as OpenClawConfig,
accountId: "default",
} as never),
).toBe(true);
expect(
mattermostSetupWizard.envShortcut?.isAvailable?.({
cfg: { channels: { mattermost: {} } } as OpenClawConfig,
accountId: "work",
} as never),
).toBe(false);
});
it("keeps env shortcut as a no-op patch for the selected account", () => {
expect(
mattermostSetupWizard.envShortcut?.apply?.({
cfg: { channels: { mattermost: { enabled: false } } } as OpenClawConfig,
accountId: "default",
} as never),
).toEqual({
channels: {
mattermost: {
enabled: true,
},
},
});
});
});
function registerEnvDefaults() {
vi.unstubAllEnvs();
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-06-07)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.