mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
// Feishu tests cover setup entry plugin behavior.
|
|
import { afterAll, describe, expect, it, vi } from "vitest";
|
|
|
|
vi.mock("@larksuiteoapi/node-sdk", () => {
|
|
throw new Error("setup entry must not load the Feishu SDK");
|
|
});
|
|
|
|
describe("feishu setup entry", () => {
|
|
afterAll(() => {
|
|
vi.doUnmock("@larksuiteoapi/node-sdk");
|
|
vi.resetModules();
|
|
});
|
|
|
|
it("declares the setup entry without importing Feishu runtime dependencies", async () => {
|
|
const { default: setupEntry } = await import("./setup-entry.js");
|
|
|
|
expect(setupEntry.kind).toBe("bundled-channel-setup-entry");
|
|
expect(setupEntry.features).toEqual({ legacyStateMigrations: true });
|
|
expect(typeof setupEntry.loadSetupPlugin).toBe("function");
|
|
expect(setupEntry.loadLegacyStateMigrationDetector?.()).toBeTypeOf("function");
|
|
expect(typeof setupEntry.setChannelRuntime).toBe("function");
|
|
});
|
|
|
|
it("wires the Feishu runtime from setup-only registration", async () => {
|
|
const { default: setupEntry } = await import("./setup-entry.js");
|
|
const runtime = { channel: { inbound: { run: vi.fn() } } };
|
|
|
|
setupEntry.setChannelRuntime?.(runtime as never);
|
|
|
|
const { getFeishuRuntime } = await import("./src/runtime.js");
|
|
expect(getFeishuRuntime()).toBe(runtime);
|
|
});
|
|
});
|