mirror of
https://github.com/hanzoai/bot.git
synced 2026-11-01 07:38:30 +00:00
The automated rebrand sed script replaced "OpenClaw" with "Hanzo Bot" (with space) instead of "HanzoBot" in 8,315 TypeScript identifier occurrences across 1,632 files. This fixes all broken class names, type names, function names, and variable names. Co-authored-by: Hanzo Dev <[email protected]>
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
import { createTestPluginApi } from "../../test/helpers/extensions/plugin-api.js";
|
|
import plugin from "./index.js";
|
|
import type { HanzoBotPluginApi } from "./runtime-api.js";
|
|
|
|
function createApi(
|
|
registrationMode: HanzoBotPluginApi["registrationMode"],
|
|
registerHttpRoute = vi.fn(),
|
|
): HanzoBotPluginApi {
|
|
return createTestPluginApi({
|
|
id: "mattermost",
|
|
name: "Mattermost",
|
|
source: "test",
|
|
config: {},
|
|
runtime: {} as HanzoBotPluginApi["runtime"],
|
|
registrationMode,
|
|
registerHttpRoute,
|
|
});
|
|
}
|
|
|
|
describe("mattermost plugin register", () => {
|
|
it("skips slash callback registration in setup-only mode", () => {
|
|
const registerHttpRoute = vi.fn();
|
|
|
|
plugin.register(createApi("setup-only", registerHttpRoute));
|
|
|
|
expect(registerHttpRoute).not.toHaveBeenCalled();
|
|
});
|
|
|
|
it("registers slash callback routes in full mode", () => {
|
|
const registerHttpRoute = vi.fn();
|
|
|
|
plugin.register(createApi("full", registerHttpRoute));
|
|
|
|
expect(registerHttpRoute).toHaveBeenCalledTimes(1);
|
|
expect(registerHttpRoute).toHaveBeenCalledWith(
|
|
expect.objectContaining({
|
|
path: "/api/channels/mattermost/command",
|
|
auth: "plugin",
|
|
}),
|
|
);
|
|
});
|
|
});
|