Files
openclaw/extensions/feishu/setup-entry.test.ts
clawsweeper[bot] a61c94b1f1 fix(feishu): wire setup runtime setter (#89814)
Summary:
- The PR adds a narrow Feishu runtime-setter entrypoint, wires it into the Feishu setup entry, and adds regression coverage for setup-only runtime registration.
- PR surface: Source +7, Tests +22. Total +29 across 4 files.
- Reproducibility: yes. source inspection gives a high-confidence reproduction path: current Feishu setup-only ... ate when that setter is present. I did not run a live Feishu tenant message repro in this read-only review.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix(feishu): wire setup runtime setter

Validation:
- ClawSweeper review passed for head befd074ca6.
- Required merge gates passed before the squash merge.

Prepared head SHA: befd074ca6
Review: https://github.com/openclaw/openclaw/pull/89814#issuecomment-4612032021

Co-authored-by: Glenn-Agent <glenn_agent@163.com>
Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com>
Approved-by: takhoffman
Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
2026-06-03 12:36:42 +00:00

33 lines
1.2 KiB
TypeScript

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);
});
});