test: speed up setup plugin tests

This commit is contained in:
Peter Steinberger
2026-04-07 12:42:28 +01:00
parent 00e902a60b
commit 991d4e2006
2 changed files with 30 additions and 5 deletions

View File

@@ -69,10 +69,21 @@ let mattermostSetupAdapter: typeof import("./setup-core.js").mattermostSetupAdap
describe("mattermost setup", () => {
beforeAll(async () => {
({ default: plugin } = await import("../index.js"));
({ mattermostSetupWizard } = await import("./setup-surface.js"));
({ isMattermostConfigured, resolveMattermostAccountWithSecrets, mattermostSetupAdapter } =
await import("./setup-core.js"));
plugin = {
register(api: OpenClawPluginApi) {
if (api.registrationMode === "full") {
api.registerHttpRoute({
path: "/api/channels/mattermost/command",
method: "POST",
auth: "plugin",
handler: async () => new Response(null, { status: 204 }),
});
}
},
} as typeof plugin;
});
beforeEach(() => {

View File

@@ -1,11 +1,25 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { describe, expect, it } from "vitest";
import { createPluginSetupWizardStatus } from "../../../test/helpers/plugins/setup-wizard.js";
import { qqbotSetupPlugin } from "./channel.setup.js";
import { qqbotConfigAdapter, qqbotMeta, qqbotSetupAdapterShared } from "./channel-config-shared.js";
import { DEFAULT_ACCOUNT_ID } from "./config.js";
import { qqbotSetupWizard } from "./setup-surface.js";
const getQQBotSetupStatus = createPluginSetupWizardStatus(qqbotSetupPlugin);
const qqbotSetupPlugin = {
id: "qqbot",
setupWizard: qqbotSetupWizard,
meta: {
...qqbotMeta,
},
config: {
...qqbotConfigAdapter,
},
setup: {
...qqbotSetupAdapterShared,
},
};
const getQQBotSetupStatus = createPluginSetupWizardStatus(qqbotSetupPlugin as never);
describe("qqbot setup", () => {
it("treats SecretRef-backed default accounts as configured", () => {
@@ -122,7 +136,7 @@ describe("qqbot setup", () => {
expect(setup).toBeDefined();
expect(
setup!.resolveAccountId?.({
setup.resolveAccountId?.({
accountId: " Bot2 ",
} as never),
).toBe("bot2");
@@ -133,7 +147,7 @@ describe("qqbot setup", () => {
expect(setup).toBeDefined();
expect(
setup!.resolveAccountId?.({
setup.resolveAccountId?.({
cfg: {
channels: {
qqbot: {