test: tighten telegram probe metadata assertions · openclaw/openclaw@444ca74
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { beforeAll, describe, expect, it } from "vitest"; |
2 | | -let API_CONSTANTS: typeof import("grammy").API_CONSTANTS; |
3 | 2 | let DEFAULT_TELEGRAM_UPDATE_TYPES: typeof import("./allowed-updates.js").DEFAULT_TELEGRAM_UPDATE_TYPES; |
4 | 3 | let resolveTelegramAllowedUpdates: typeof import("./allowed-updates.js").resolveTelegramAllowedUpdates; |
5 | 4 | |
6 | 5 | beforeAll(async () => { |
7 | | -({ API_CONSTANTS } = await import("grammy")); |
8 | 6 | ({ DEFAULT_TELEGRAM_UPDATE_TYPES, resolveTelegramAllowedUpdates } = |
9 | 7 | await import("./allowed-updates.js")); |
10 | 8 | }); |
11 | 9 | |
12 | 10 | describe("resolveTelegramAllowedUpdates", () => { |
13 | 11 | it("includes the default update types plus reaction and channel post support", () => { |
14 | 12 | const updates = resolveTelegramAllowedUpdates(); |
| 13 | +const expectedUpdates = [...DEFAULT_TELEGRAM_UPDATE_TYPES]; |
| 14 | +if (!expectedUpdates.includes("message_reaction")) { |
| 15 | +expectedUpdates.push("message_reaction"); |
| 16 | +} |
| 17 | +if (!expectedUpdates.includes("channel_post")) { |
| 18 | +expectedUpdates.push("channel_post"); |
| 19 | +} |
15 | 20 | |
16 | | -expect(updates).toEqual( |
17 | | -expect.arrayContaining([ |
18 | | - ...DEFAULT_TELEGRAM_UPDATE_TYPES, |
19 | | - ...(API_CONSTANTS?.DEFAULT_UPDATE_TYPES ?? []), |
20 | | -]), |
21 | | -); |
| 21 | +expect(updates).toEqual(expectedUpdates); |
22 | 22 | expect(updates).toContain("message_reaction"); |
23 | 23 | expect(updates).toContain("channel_post"); |
24 | 24 | expect(new Set(updates).size).toBe(updates.length); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。