mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-14 18:51:04 +00:00
test: speed up setup plugin tests
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user