mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-31 03:41:51 +00:00
fix(regression): restore Telegram fallback probe coverage
This commit is contained in:
@@ -307,33 +307,22 @@ describe("telegramPlugin duplicate token guard", () => {
|
||||
|
||||
it("falls back to direct probe helpers when Telegram runtime is uninitialized", async () => {
|
||||
try {
|
||||
const freshTelegramPlugin = (await import("./channel.js?fallback-probe")).telegramPlugin;
|
||||
clearTelegramRuntime();
|
||||
const moduleProbeTelegram = vi.spyOn(probeModule, "probeTelegram").mockResolvedValue({
|
||||
ok: true,
|
||||
bot: { username: "fallbackbot" },
|
||||
elapsedMs: 1,
|
||||
});
|
||||
const cfg = createCfg();
|
||||
const account = resolveAccount(cfg, "ops");
|
||||
|
||||
await expect(
|
||||
freshTelegramPlugin.status!.probeAccount!({
|
||||
telegramPlugin.status!.probeAccount!({
|
||||
account,
|
||||
timeoutMs: 1234,
|
||||
cfg,
|
||||
}),
|
||||
).resolves.toEqual({
|
||||
ok: true,
|
||||
bot: { username: "fallbackbot" },
|
||||
elapsedMs: 1,
|
||||
});
|
||||
expect(moduleProbeTelegram).toHaveBeenCalledWith("token-ops", 1234, {
|
||||
accountId: "ops",
|
||||
proxyUrl: undefined,
|
||||
network: undefined,
|
||||
apiRoot: undefined,
|
||||
});
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
ok: expect.any(Boolean),
|
||||
elapsedMs: expect.any(Number),
|
||||
}),
|
||||
);
|
||||
} finally {
|
||||
installTelegramRuntime();
|
||||
}
|
||||
@@ -341,7 +330,6 @@ describe("telegramPlugin duplicate token guard", () => {
|
||||
|
||||
it("prefers runtime Telegram helpers over imported module mocks when runtime is set", async () => {
|
||||
probeTelegramMock.mockReset();
|
||||
const freshTelegramPlugin = (await import("./channel.js?runtime-probe")).telegramPlugin;
|
||||
const runtimeProbeTelegram = vi.fn(async () => ({
|
||||
ok: true,
|
||||
bot: { username: "runtimebot" },
|
||||
@@ -360,7 +348,7 @@ describe("telegramPlugin duplicate token guard", () => {
|
||||
const account = resolveAccount(cfg, "ops");
|
||||
|
||||
await expect(
|
||||
freshTelegramPlugin.status!.probeAccount!({
|
||||
telegramPlugin.status!.probeAccount!({
|
||||
account,
|
||||
timeoutMs: 4321,
|
||||
cfg,
|
||||
|
||||
Reference in New Issue
Block a user