mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 04:20:43 +00:00
test: clarify telegram command assertions
This commit is contained in:
@@ -23,7 +23,7 @@ function warningLines(): string[] {
|
||||
}
|
||||
|
||||
function expectNoMissingDefaultWarning() {
|
||||
expect(warningLines().every((line) => !line.includes("accounts.default is missing"))).toBe(true);
|
||||
expect(warningLines().filter((line) => line.includes("accounts.default is missing"))).toEqual([]);
|
||||
}
|
||||
|
||||
function resolveAccountWithEnv(
|
||||
|
||||
@@ -69,8 +69,8 @@ describe("bot-native-command-menu", () => {
|
||||
0,
|
||||
);
|
||||
expect(totalText).toBeLessThanOrEqual(TELEGRAM_TOTAL_COMMAND_TEXT_BUDGET);
|
||||
expect(result.commandsToRegister.every((command) => command.description.length <= 56)).toBe(
|
||||
true,
|
||||
expect(result.commandsToRegister.filter((command) => command.description.length > 56)).toEqual(
|
||||
[],
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ describe("registerTelegramNativeCommands skill allowlist integration", () => {
|
||||
|
||||
const registeredCommands = await waitForRegisteredCommands(setMyCommands);
|
||||
|
||||
expect(registeredCommands.some((entry) => entry.command === "alpha_skill")).toBe(true);
|
||||
expect(registeredCommands.some((entry) => entry.command === "beta_skill")).toBe(false);
|
||||
expect(registeredCommands.map((entry) => entry.command)).toContain("alpha_skill");
|
||||
expect(registeredCommands.map((entry) => entry.command)).not.toContain("beta_skill");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -116,7 +116,7 @@ describe("markdownToTelegramHtml", () => {
|
||||
it("splits long multiline html text without breaking balanced tags", () => {
|
||||
const chunks = splitTelegramHtmlChunks(`<b>${"A\n".repeat(2500)}</b>`, 4000);
|
||||
expect(chunks.length).toBeGreaterThan(1);
|
||||
expect(chunks.every((chunk) => chunk.length <= 4000)).toBe(true);
|
||||
expect(chunks.filter((chunk) => chunk.length > 4000)).toEqual([]);
|
||||
expect(chunks[0]).toMatch(/^<b>[\s\S]*<\/b>$/);
|
||||
expect(chunks[1]).toMatch(/^<b>[\s\S]*<\/b>$/);
|
||||
});
|
||||
@@ -128,7 +128,7 @@ describe("markdownToTelegramHtml", () => {
|
||||
it("treats malformed leading ampersands as plain text when chunking html", () => {
|
||||
const chunks = splitTelegramHtmlChunks(`&${"A".repeat(5000)}`, 4000);
|
||||
expect(chunks.length).toBeGreaterThan(1);
|
||||
expect(chunks.every((chunk) => chunk.length <= 4000)).toBe(true);
|
||||
expect(chunks.filter((chunk) => chunk.length > 4000)).toEqual([]);
|
||||
});
|
||||
|
||||
it("fails loudly when tag overhead leaves no room for text", () => {
|
||||
|
||||
Reference in New Issue
Block a user